about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-15 12:58:07 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-15 12:58:07 -0600
commit28960db85c695897236ab29087b53f620759133b (patch)
treef6cb0caf12b8278202a62345f446cc4e1120ef91
parent5775e248675f60885eee31ba8d64e67f2b6dbf69 (diff)
add missing null constaint & backfill `statuses.hidden` column to `false`
-rw-r--r--db/migrate/20200215021014_backfill_statuses_hidden.rb8
-rw-r--r--db/migrate/20200215021731_set_statuses_hidden_not_null.rb (renamed from db/migrate/20200215021014_set_null_constraint_on_statuses_hidden.rb)2
-rw-r--r--db/migrate/20200215021732_validate_statuses_hidden_not_null.rb (renamed from db/migrate/20200215021731_validate_set_default_unhidden_on_statuses.rb)2
3 files changed, 10 insertions, 2 deletions
diff --git a/db/migrate/20200215021014_backfill_statuses_hidden.rb b/db/migrate/20200215021014_backfill_statuses_hidden.rb
new file mode 100644
index 000000000..59e2e40ac
--- /dev/null
+++ b/db/migrate/20200215021014_backfill_statuses_hidden.rb
@@ -0,0 +1,8 @@
+class BackfillStatusesHidden < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    Rails.logger.info("Setting all statuses unhidden by default.  This may take a really long time.")
+    Status.in_batches.update_all(hidden: false)
+  end
+end
diff --git a/db/migrate/20200215021014_set_null_constraint_on_statuses_hidden.rb b/db/migrate/20200215021731_set_statuses_hidden_not_null.rb
index 70b3a764c..d16dc9f38 100644
--- a/db/migrate/20200215021014_set_null_constraint_on_statuses_hidden.rb
+++ b/db/migrate/20200215021731_set_statuses_hidden_not_null.rb
@@ -1,4 +1,4 @@
-class SetNullConstraintOnStatusesHidden < ActiveRecord::Migration[5.2]
+class SetStatusesHiddenNotNull < ActiveRecord::Migration[5.2]
   def change
     safety_assured do
       execute 'ALTER TABLE "statuses" ADD CONSTRAINT "statuses_hidden_null" CHECK ("hidden" IS NOT NULL) NOT VALID'
diff --git a/db/migrate/20200215021731_validate_set_default_unhidden_on_statuses.rb b/db/migrate/20200215021732_validate_statuses_hidden_not_null.rb
index b87b61dcc..0822ff73c 100644
--- a/db/migrate/20200215021731_validate_set_default_unhidden_on_statuses.rb
+++ b/db/migrate/20200215021732_validate_statuses_hidden_not_null.rb
@@ -1,4 +1,4 @@
-class ValidateSetDefaultUnhiddenOnStatuses < ActiveRecord::Migration[5.2]
+class ValidateStatusesHiddenNotNull < ActiveRecord::Migration[5.2]
   def change
     safety_assured do
       execute 'ALTER TABLE "statuses" VALIDATE CONSTRAINT "statuses_hidden_null"'