]> git.openstreetmap.org Git - rails.git/commitdiff
Build new relation member indexes concurrently
authorTom Hughes <tom@compton.nu>
Thu, 26 Oct 2023 18:58:11 +0000 (19:58 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 26 Oct 2023 18:58:11 +0000 (19:58 +0100)
db/migrate/20231010194809_correct_relation_members_primary_key.rb

index e1f7dcf467881cc78f24fafe573206ce387d5640..84388063e330699162e321d98fe8f75d4890d79a 100644 (file)
@@ -2,12 +2,12 @@ class CorrectRelationMembersPrimaryKey < ActiveRecord::Migration[7.0]
   disable_ddl_transaction!
 
   def up
-    alter_primary_key :current_relation_members, [:relation_id, :sequence_id]
-    alter_primary_key :relation_members, [:relation_id, :version, :sequence_id]
+    alter_primary_key :current_relation_members, [:relation_id, :sequence_id], :algorithm => :concurrently
+    alter_primary_key :relation_members, [:relation_id, :version, :sequence_id], :algorithm => :concurrently
   end
 
   def down
-    alter_primary_key :relation_members, [:relation_id, :version, :member_type, :member_id, :member_role, :sequence_id]
-    alter_primary_key :current_relation_members, [:relation_id, :member_type, :member_id, :member_role, :sequence_id]
+    alter_primary_key :relation_members, [:relation_id, :version, :member_type, :member_id, :member_role, :sequence_id], :algorithm => :concurrently
+    alter_primary_key :current_relation_members, [:relation_id, :member_type, :member_id, :member_role, :sequence_id], :algorithm => :concurrently
   end
 end