From 2ae3a29508e2a5daab6dd3eea3e10e40df6fd945 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Thu, 19 Jul 2018 20:43:33 -0400 Subject: Add a foreign-key constraint to the attachments table for blobs --- activestorage/db/migrate/20170806125915_create_active_storage_tables.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activestorage/db/migrate') diff --git a/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb b/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb index 9e31e3966a..cfaf01cd5e 100644 --- a/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb +++ b/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb @@ -20,6 +20,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2] t.datetime :created_at, null: false t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id end end end -- cgit v1.2.3