diff --git a/db/migrate/20201203035119_add_index_to_reactions.rb b/db/migrate/20201203035119_add_index_to_reactions.rb index 5a7efb902ab..3de2a54648d 100644 --- a/db/migrate/20201203035119_add_index_to_reactions.rb +++ b/db/migrate/20201203035119_add_index_to_reactions.rb @@ -2,10 +2,6 @@ class AddIndexToReactions < ActiveRecord::Migration[6.0] def change - # インデックス名の長さ制限を超えてしまうため短い名前にする - add_index :reactions, - %i[user_id reactionable_id reactionable_type kind], - unique: true, - name: 'index_reactions_on_reactionable_u_k' + add_index :reactions, [:user_id, :reactionable_id, :reactionable_type, :kind], unique: true, name: 'index_reactions_on_reactionable' end end diff --git a/db/migrate/20240321092012_create_movies.rb b/db/migrate/20240321092012_create_movies.rb index ab915be43a3..5640ff2ce76 100644 --- a/db/migrate/20240321092012_create_movies.rb +++ b/db/migrate/20240321092012_create_movies.rb @@ -3,9 +3,7 @@ def change create_table :movies do |t| t.string :title , null: false t.text :description - t.string :tag_list - t.references :user, foreign_key: true, null: false - t.references :practice, foreign_key: true + t.references :user, foreign_key: true, null: true t.timestamps end diff --git a/db/migrate/20250618142946_add_index_on_source_id_to_practices.rb b/db/migrate/20250618142946_add_index_on_source_id_to_practices.rb new file mode 100644 index 00000000000..973c8fdfdac --- /dev/null +++ b/db/migrate/20250618142946_add_index_on_source_id_to_practices.rb @@ -0,0 +1,5 @@ +class AddIndexOnSourceIdToPractices < ActiveRecord::Migration[6.1] + def change + add_index :practices, :source_id + end +end diff --git a/db/migrate/20250618144325_add_foreign_key_to_practices_source_id.rb b/db/migrate/20250618144325_add_foreign_key_to_practices_source_id.rb new file mode 100644 index 00000000000..0c658a29717 --- /dev/null +++ b/db/migrate/20250618144325_add_foreign_key_to_practices_source_id.rb @@ -0,0 +1,5 @@ +class AddForeignKeyToPracticesSourceId < ActiveRecord::Migration[6.1] + def change + add_foreign_key :practices, :practices, column: :source_id + end +end