summaryrefslogtreecommitdiff
path: root/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb')
-rw-r--r--db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb b/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb
new file mode 100644
index 00000000000..11d47904e67
--- /dev/null
+++ b/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class MigrateDefaultDiffMaxPatchBytesToMinimum200kb < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+ MAX_SIZE = 200.kilobytes
+
+ class ApplicationSetting < ActiveRecord::Base
+ self.table_name = 'application_settings'
+ end
+
+ def up
+ table = ApplicationSetting.arel_table
+ ApplicationSetting.where(table[:diff_max_patch_bytes].lt(MAX_SIZE)).update_all(diff_max_patch_bytes: MAX_SIZE)
+ end
+
+ def down
+ table = ApplicationSetting.arel_table
+ ApplicationSetting.where(table[:diff_max_patch_bytes].eq(MAX_SIZE)).update_all(diff_max_patch_bytes: 100.kilobytes)
+ end
+end