]> cat aescling's git repositories - mastodon.git/commitdiff
Fix unsafe column type change in migration (#12653)
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 18 Dec 2019 18:04:43 +0000 (19:04 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Dec 2019 18:04:43 +0000 (19:04 +0100)
db/migrate/20191212003415_increase_backup_size.rb

index 782c67db1ea769eda759293507090aa4aa44e637..a5192263cf1f5dddbbe7fa776bf1568f9b35c553 100644 (file)
@@ -1,9 +1,21 @@
+require Rails.root.join('lib', 'mastodon', 'migration_helpers')
+
 class IncreaseBackupSize < ActiveRecord::Migration[5.2]
+  include Mastodon::MigrationHelpers
+
+  disable_ddl_transaction!
+
   def up
-    change_column :backups, :dump_file_size, :bigint
+    safety_assured do
+      change_column_type_concurrently :backups, :dump_file_size, :bigint
+      cleanup_concurrent_column_type_change :backups, :dump_file_size
+    end
   end
 
   def down
-    change_column :backups, :dump_file_size, :integer
+    safety_assured do
+      change_column_type_concurrently :backups, :dump_file_size, :integer
+      cleanup_concurrent_column_type_change :backups, :dump_file_size
+    end
   end
 end