about summary refs log tree commit diff
path: root/db/migrate/20200630222517_backfill_default_statuses_edited.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200630222517_backfill_default_statuses_edited.rb')
-rw-r--r--db/migrate/20200630222517_backfill_default_statuses_edited.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/20200630222517_backfill_default_statuses_edited.rb b/db/migrate/20200630222517_backfill_default_statuses_edited.rb
new file mode 100644
index 000000000..cbcbd600b
--- /dev/null
+++ b/db/migrate/20200630222517_backfill_default_statuses_edited.rb
@@ -0,0 +1,14 @@
+class BackfillDefaultStatusesEdited < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    Rails.logger.info('Backfilling "edited" column of table "statuses" to default value 0...')
+    Status.unscoped.in_batches do |statuses|
+      statuses.update_all(edited: 0)
+    end
+  end
+
+  def down
+    true
+  end
+end