Add default_preferred_language to application_settings
requested to merge gitlab-jh/jh-team/gitlab:db/add-default-preferred-language-to-application-settings into master
What does this MR do and why?
In order to facilitate the database review, this MR is extracted from the !101621 (merged).
Add default_preferred_language
to application_settings
,
to allow administrators to set language preference for new users by configuring default_preferred_language
.
Default behavior not changed, default preference is English "en".
Reference from doc: https://docs.gitlab.com/ee/development/database/strings_and_the_text_data_type.html
Migration log
Migrate
bundle exec rails db:migrate
main: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: migrating =
main: -- add_column(:application_settings, :default_preferred_language, :text, {:default=>"en", :null=>false})
main: -> 0.0065s
main: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: migrated (0.0072s)
main: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: migrating
main: -- transaction_open?()
main: -> 0.0000s
main: -- current_schema()
main: -> 0.0005s
main: -- transaction_open?()
main: -> 0.0000s
main: -- execute("ALTER TABLE application_settings\nADD CONSTRAINT check_e2692d7523\nCHECK ( char_length(default_preferred_language) <= 32 )\nNOT VALID;\n")
main: -> 0.0020s
main: -- current_schema()
main: -> 0.0004s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT check_e2692d7523;")
main: -> 0.0016s
main: -- execute("RESET statement_timeout")
main: -> 0.0005s
main: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: migrated (0.0250s)
ci: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: migrating =
ci: -- add_column(:application_settings, :default_preferred_language, :text, {:default=>"en", :null=>false})
ci: -> 0.0044s
ci: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: migrated (0.0046s)
ci: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: migrating
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- current_schema()
ci: -> 0.0003s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- execute("ALTER TABLE application_settings\nADD CONSTRAINT check_e2692d7523\nCHECK ( char_length(default_preferred_language) <= 32 )\nNOT VALID;\n")
ci: -> 0.0018s
ci: -- current_schema()
ci: -> 0.0004s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0004s
ci: -- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT check_e2692d7523;")
ci: -> 0.0013s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0005s
ci: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: migrated (0.0122s)
Rollback
bundle exec rails db:rollback:main STEP=2
main: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: reverting
main: -- transaction_open?()
main: -> 0.0000s
main: -- transaction_open?()
main: -> 0.0000s
main: -- execute(" ALTER TABLE application_settings\n DROP CONSTRAINT IF EXISTS check_e2692d7523\n")
main: -> 0.0029s
main: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: reverted (0.0212s)
main: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: reverting =
main: -- remove_column(:application_settings, :default_preferred_language, :text, {:default=>"en", :null=>false})
main: -> 0.0027s
main: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: reverted (0.0051s)
bundle exec rails db:rollback:ci STEP=2
ci: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: reverting
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- execute(" ALTER TABLE application_settings\n DROP CONSTRAINT IF EXISTS check_e2692d7523\n")
ci: -> 0.0025s
ci: == 20221101032600 AddTextLimitToDefaultPreferredLanguageOnApplicationSettings: reverted (0.0170s)
ci: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: reverting =
ci: -- remove_column(:application_settings, :default_preferred_language, :text, {:default=>"en", :null=>false})
ci: -> 0.0024s
ci: == 20221101032521 AddDefaultPreferredLanguageToApplicationSettings: reverted (0.0046s)
/cc JH EM @prajnamas
Edited by Baodong