1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/active_storage/migration.rb

29 lines
665 B
Ruby
Raw Normal View History

class ActiveStorageCreateTables < ActiveRecord::Migration[5.1]
2017-06-30 13:12:58 -04:00
def change
create_table :active_storage_blobs do |t|
2017-07-05 09:18:50 -04:00
t.string :key
t.string :filename
t.string :content_type
t.text :metadata
2017-06-30 13:12:58 -04:00
t.integer :byte_size
2017-07-05 09:18:50 -04:00
t.string :checksum
t.time :created_at
2017-06-30 13:12:58 -04:00
2017-07-03 11:07:17 -04:00
t.index [ :key ], unique: true
2017-06-30 13:12:58 -04:00
end
2017-07-05 09:18:50 -04:00
create_table :active_storage_attachments do |t|
2017-07-05 09:18:50 -04:00
t.string :name
t.string :record_gid
t.integer :blob_id
t.time :created_at
t.index :record_gid
t.index :blob_id
t.index [ :record_gid, :name ]
t.index [ :record_gid, :blob_id ], unique: true
end
2017-06-30 13:12:58 -04:00
end
end