From 58376eeddac328d275339cd920a49bb29067f1c6 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 22 Mar 2024 17:22:36 +0100 Subject: [PATCH] Remove obsolete `admin` and `moderator` columns from `users` table (#29718) --- app/models/user.rb | 2 -- .../20240322161611_remove_obsolete_roles_from_users.rb | 8 ++++++++ db/schema.rb | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 db/post_migrate/20240322161611_remove_obsolete_roles_from_users.rb diff --git a/app/models/user.rb b/app/models/user.rb index ee9116b9f4..17ec90c9ee 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,7 +14,6 @@ # sign_in_count :integer default(0), not null # current_sign_in_at :datetime # last_sign_in_at :datetime -# admin :boolean default(FALSE), not null # confirmation_token :string # confirmed_at :datetime # confirmation_sent_at :datetime @@ -29,7 +28,6 @@ # otp_backup_codes :string is an Array # account_id :bigint(8) not null # disabled :boolean default(FALSE), not null -# moderator :boolean default(FALSE), not null # invite_id :bigint(8) # chosen_languages :string is an Array # created_by_application_id :bigint(8) diff --git a/db/post_migrate/20240322161611_remove_obsolete_roles_from_users.rb b/db/post_migrate/20240322161611_remove_obsolete_roles_from_users.rb new file mode 100644 index 0000000000..8a46a1d7d3 --- /dev/null +++ b/db/post_migrate/20240322161611_remove_obsolete_roles_from_users.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class RemoveObsoleteRolesFromUsers < ActiveRecord::Migration[7.1] + def change + safety_assured { remove_column :users, :admin, :boolean, default: false, null: false } + safety_assured { remove_column :users, :moderator, :boolean, default: false, null: false } + end +end diff --git a/db/schema.rb b/db/schema.rb index dcf16a7ed9..27c486487d 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[7.1].define(version: 2024_03_22_130318) do +ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1170,7 +1170,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_130318) do t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at", precision: nil t.datetime "last_sign_in_at", precision: nil - t.boolean "admin", default: false, null: false t.string "confirmation_token" t.datetime "confirmed_at", precision: nil t.datetime "confirmation_sent_at", precision: nil @@ -1185,7 +1184,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_130318) do t.string "otp_backup_codes", array: true t.bigint "account_id", null: false t.boolean "disabled", default: false, null: false - t.boolean "moderator", default: false, null: false t.bigint "invite_id" t.string "chosen_languages", array: true t.bigint "created_by_application_id"