about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-07-13 03:12:25 +0200
committerGitHub <noreply@github.com>2017-07-13 03:12:25 +0200
commit880a5eb25cc62d2181b34a21985addee847cbb49 (patch)
treeca0b37ff4b1be7606ed1bf3ad7c6bebb8cb68cce /db/migrate
parente48d3bfd01c4bdeb36d39bbdf13b6873e3444179 (diff)
Fix boolean columns sometimes having a null value (#4162)
* Fix boolean columns sometimes having a null value

* Fix wrong value being set instead of null
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170711225116_fix_null_booleans.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20170711225116_fix_null_booleans.rb b/db/migrate/20170711225116_fix_null_booleans.rb
new file mode 100644
index 000000000..5b319471d
--- /dev/null
+++ b/db/migrate/20170711225116_fix_null_booleans.rb
@@ -0,0 +1,17 @@
+class FixNullBooleans < ActiveRecord::Migration[5.1]
+  def change
+    change_column_default :domain_blocks, :reject_media, false
+    change_column_null :domain_blocks, :reject_media, false, false
+
+    change_column_default :imports, :approved, false
+    change_column_null :imports, :approved, false, false
+
+    change_column_null :statuses, :sensitive, false, false
+    change_column_null :statuses, :reply, false, false
+
+    change_column_null :users, :admin, false, false
+
+    change_column_default :users, :otp_required_for_login, false
+    change_column_null :users, :otp_required_for_login, false, false
+  end
+end