diff options
author | Matthew Draper <matthew@trebex.net> | 2017-08-13 20:15:49 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-13 20:15:49 +0930 |
commit | f505f23ca4ab28c9ef06350b093c832f1982cac1 (patch) | |
tree | fdd0ef04f877b357868a71a088f71b0c83be2b3a | |
parent | 3e676822c05f1166e2880f162c864c3655eaa281 (diff) | |
parent | 4966b36d4c6850722d9526dda9110df6c5656a26 (diff) | |
download | rails-f505f23ca4ab28c9ef06350b093c832f1982cac1.tar.gz rails-f505f23ca4ab28c9ef06350b093c832f1982cac1.tar.bz2 rails-f505f23ca4ab28c9ef06350b093c832f1982cac1.zip |
Merge pull request #30222 from kamipo/respect_pk_type
Use `references` to respect primary key type in active storage tables
-rw-r--r-- | activestorage/db/migrate/20170806125915_create_active_storage_tables.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb b/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb index 2c7e3c5bc6..8dc000821b 100644 --- a/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb +++ b/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb @@ -13,14 +13,12 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.1] end create_table :active_storage_attachments do |t| - t.string :name, null: false - t.string :record_type, null: false - t.integer :record_id, null: false - t.integer :blob_id, null: false + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false + t.references :blob, null: false t.datetime :created_at, null: false - t.index :blob_id t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true end end |