1 # frozen_string_literal: true
 
   3 # This migration comes from active_storage (originally 20170806125915)
 
   4 class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
 
   6     create_table :active_storage_blobs do |t|
 
   7       t.string   :key,        :null => false
 
   8       t.string   :filename,   :null => false
 
  11       t.bigint   :byte_size,  :null => false
 
  12       t.string   :checksum,   :null => false
 
  13       t.datetime :created_at, :null => false
 
  15       t.index [:key], :unique => true
 
  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
 
  23       t.datetime :created_at, :null => false
 
  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