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