]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20190702193519_create_active_storage_tables.rb
Update to rails 6.0.3.7
[rails.git] / db / migrate / 20190702193519_create_active_storage_tables.rb
1 # This migration comes from active_storage (originally 20170806125915)
2 class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3   def change
4     create_table :active_storage_blobs do |t|
5       t.string   :key,        :null => false
6       t.string   :filename,   :null => false
7       t.string   :content_type
8       t.text     :metadata
9       t.bigint   :byte_size,  :null => false
10       t.string   :checksum,   :null => false
11       t.datetime :created_at, :null => false
12
13       t.index [:key], :unique => true
14     end
15
16     create_table :active_storage_attachments do |t|
17       t.string     :name,     :null => false
18       t.references :record,   :null => false, :polymorphic => true, :index => false
19       t.references :blob,     :null => false
20
21       t.datetime :created_at, :null => false
22
23       t.index [:record_type, :record_id, :name, :blob_id], :name => "index_active_storage_attachments_uniqueness", :unique => true
24       t.foreign_key :active_storage_blobs, :column => :blob_id
25     end
26   end
27 end