diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-13 03:12:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 03:12:25 +0200 |
commit | 880a5eb25cc62d2181b34a21985addee847cbb49 (patch) | |
tree | ca0b37ff4b1be7606ed1bf3ad7c6bebb8cb68cce /db | |
parent | e48d3bfd01c4bdeb36d39bbdf13b6873e3444179 (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')
-rw-r--r-- | db/migrate/20170711225116_fix_null_booleans.rb | 17 | ||||
-rw-r--r-- | db/schema.rb | 14 |
2 files changed, 24 insertions, 7 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 diff --git a/db/schema.rb b/db/schema.rb index 159704c6a..0d5c73e2e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170625140443) do +ActiveRecord::Schema.define(version: 20170711225116) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -89,7 +89,7 @@ ActiveRecord::Schema.define(version: 20170625140443) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "severity", default: 0 - t.boolean "reject_media" + t.boolean "reject_media", default: false, null: false t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true end @@ -121,7 +121,7 @@ ActiveRecord::Schema.define(version: 20170625140443) do create_table "imports", id: :serial, force: :cascade do |t| t.integer "account_id", null: false t.integer "type", null: false - t.boolean "approved" + t.boolean "approved", default: false, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "data_file_name" @@ -281,12 +281,12 @@ ActiveRecord::Schema.define(version: 20170625140443) do t.bigint "in_reply_to_id" t.bigint "reblog_of_id" t.string "url" - t.boolean "sensitive", default: false + t.boolean "sensitive", default: false, null: false t.integer "visibility", default: 0, null: false t.integer "in_reply_to_account_id" t.integer "application_id" t.text "spoiler_text", default: "", null: false - t.boolean "reply", default: false + t.boolean "reply", default: false, null: false t.integer "favourites_count", default: 0, null: false t.integer "reblogs_count", default: 0, null: false t.string "language" @@ -350,7 +350,7 @@ ActiveRecord::Schema.define(version: 20170625140443) do t.datetime "last_sign_in_at" t.inet "current_sign_in_ip" t.inet "last_sign_in_ip" - t.boolean "admin", default: false + t.boolean "admin", default: false, null: false t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" @@ -360,7 +360,7 @@ ActiveRecord::Schema.define(version: 20170625140443) do t.string "encrypted_otp_secret_iv" t.string "encrypted_otp_secret_salt" t.integer "consumed_timestep" - t.boolean "otp_required_for_login" + t.boolean "otp_required_for_login", default: false, null: false t.datetime "last_emailed_at" t.string "otp_backup_codes", array: true t.string "filtered_languages", default: [], null: false, array: true |