up: makes polymorphic column type smaller
parent
99c1a1fff6
commit
f2f31a5f49
|
@ -7,11 +7,15 @@ class CreateRateTable < ActiveRecord::Migration[5.0]
|
|||
|
||||
t.references :author, index: true, null: false, polymorphic: true
|
||||
t.references :resource, index: true, null: false, polymorphic: true
|
||||
t.references :scopeable, index: true, null: true, polymorphic: true
|
||||
t.references :scopeable, index: true, null: true, polymorphic: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
change_column :rating_rates, :author_type, :string, limit: 10
|
||||
change_column :rating_rates, :resource_type, :string, limit: 10
|
||||
change_column :rating_rates, :scopeable_type, :string, limit: 10
|
||||
|
||||
add_index :rating_rates, %i[author_type author_id resource_type resource_id scopeable_type scopeable_id],
|
||||
name: :index_rating_rates_on_author_and_resource_and_scopeable,
|
||||
unique: true
|
||||
|
|
|
@ -14,6 +14,9 @@ class CreateRatingTable < ActiveRecord::Migration[5.0]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
change_column :rating_ratings, :resource_type, :string, limit: 10
|
||||
change_column :rating_ratings, :scopeable_type, :string, limit: 10
|
||||
|
||||
add_index :rating_ratings, %i[resource_type resource_id scopeable_type scopeable_id],
|
||||
name: :index_rating_rating_on_resource_and_scopeable,
|
||||
unique: true
|
||||
|
|
Loading…
Reference in New Issue