|
| 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.string :service_name, null: false |
| 10 | + t.bigint :byte_size, null: false |
| 11 | + t.string :checksum, null: false |
| 12 | + t.datetime :created_at, null: false |
| 13 | + |
| 14 | + t.index [ :key ], unique: true |
| 15 | + end |
| 16 | + |
| 17 | + create_table :active_storage_attachments do |t| |
| 18 | + t.string :name, null: false |
| 19 | + t.references :record, null: false, polymorphic: true, index: false |
| 20 | + t.references :blob, null: false |
| 21 | + |
| 22 | + t.datetime :created_at, null: false |
| 23 | + |
| 24 | + t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true |
| 25 | + t.foreign_key :active_storage_blobs, column: :blob_id |
| 26 | + end |
| 27 | + |
| 28 | + create_table :active_storage_variant_records do |t| |
| 29 | + t.belongs_to :blob, null: false, index: false |
| 30 | + t.string :variation_digest, null: false |
| 31 | + |
| 32 | + t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true |
| 33 | + t.foreign_key :active_storage_blobs, column: :blob_id |
| 34 | + end |
| 35 | + end |
| 36 | +end |
0 commit comments