]> cat aescling's git repositories - mastodon.git/commitdiff
Use disable_ddl_transaction! to prevent warnings on migration (#6183)
authorunarist <m.unarist@gmail.com>
Thu, 4 Jan 2018 18:38:29 +0000 (03:38 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 4 Jan 2018 18:38:29 +0000 (19:38 +0100)
Migration is wrapped by transaction, so manual `commit_db_transaction` without transaction restarting causes "there is no transaction in progress" warnings. We should use `disable_ddl_transaction!` instead, if we can omit transaction completely.

db/migrate/20171129172043_add_index_on_stream_entries.rb
db/migrate/20171226094803_more_faster_index_on_notifications.rb

index 478530c7fdb34f502103a2bbf2d00f46bd0b4cc6..181c4f28827e762292887ede4de729d4f10db858 100644 (file)
@@ -1,6 +1,7 @@
 class AddIndexOnStreamEntries < ActiveRecord::Migration[5.1]
+  disable_ddl_transaction!
+
   def change
-    commit_db_transaction
     add_index :stream_entries, [:account_id, :activity_type, :id], algorithm: :concurrently
     remove_index :stream_entries, name: :index_stream_entries_on_account_id
   end
index b2e53b82ddca046d8779556869fbc2eb241c2c8a..0273a4e7c142ef0b68b9e5742eec89094a182950 100644 (file)
@@ -1,6 +1,7 @@
 class MoreFasterIndexOnNotifications < ActiveRecord::Migration[5.1]
+  disable_ddl_transaction!
+
   def change
-    commit_db_transaction
     add_index :notifications, [:account_id, :id], order: { id: :desc }, algorithm: :concurrently
     remove_index :notifications, name: :index_notifications_on_id_and_account_id_and_activity_type
   end