Class: CreateSnapshotBlobReferences

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/templates/snapshot_v2/create_snapshot_blob_references.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
# File 'lib/generators/templates/snapshot_v2/create_snapshot_blob_references.rb', line 2

def change
  create_table :snapshot_blob_references do |t|
    t.belongs_to :snapshot, null: false, foreign_key: { to_table: :snapshots }
    t.belongs_to :blob, null: false, foreign_key: { to_table: :active_storage_blobs }
    t.timestamps
  end
  add_index :snapshot_blob_references, [:snapshot_id, :blob_id], unique: true
end