Remove unused `filtered_languages` column (#18533)

* Remove unused `filtered_languages` column

Fixes #18522

* Fix tests
This commit is contained in:
Claire 2022-05-27 20:05:22 +02:00 committed by GitHub
parent fbcbf7898f
commit e34dd3644c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -26,7 +26,6 @@
# otp_required_for_login :boolean default(FALSE), not null # otp_required_for_login :boolean default(FALSE), not null
# last_emailed_at :datetime # last_emailed_at :datetime
# otp_backup_codes :string is an Array # otp_backup_codes :string is an Array
# filtered_languages :string default([]), not null, is an Array
# account_id :bigint(8) not null # account_id :bigint(8) not null
# disabled :boolean default(FALSE), not null # disabled :boolean default(FALSE), not null
# moderator :boolean default(FALSE), not null # moderator :boolean default(FALSE), not null
@ -48,6 +47,7 @@ class User < ApplicationRecord
current_sign_in_ip current_sign_in_ip
last_sign_in_ip last_sign_in_ip
skip_sign_in_token skip_sign_in_token
filtered_languages
) )
include Settings::Extend include Settings::Extend

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class RemoveFilteredLanguagesFromUsers < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def change
safety_assured do
remove_column :users, :filtered_languages, :string, array: true, default: [], null: false
end
end
end

View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_04_29_101850) do ActiveRecord::Schema.define(version: 2022_05_27_114923) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -983,7 +983,6 @@ ActiveRecord::Schema.define(version: 2022_04_29_101850) do
t.boolean "otp_required_for_login", default: false, null: false t.boolean "otp_required_for_login", default: false, null: false
t.datetime "last_emailed_at" t.datetime "last_emailed_at"
t.string "otp_backup_codes", array: true t.string "otp_backup_codes", array: true
t.string "filtered_languages", default: [], null: false, array: true
t.bigint "account_id", null: false t.bigint "account_id", null: false
t.boolean "disabled", default: false, null: false t.boolean "disabled", default: false, null: false
t.boolean "moderator", default: false, null: false t.boolean "moderator", default: false, null: false

View File

@ -3,7 +3,7 @@ require 'rails_helper'
describe Settings::Preferences::OtherController do describe Settings::Preferences::OtherController do
render_views render_views
let(:user) { Fabricate(:user, filtered_languages: []) } let(:user) { Fabricate(:user, chosen_languages: []) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user