diff --git a/config/settings.yml b/config/settings.yml index 208c8e3760c2e5..9793e85537bf26 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -9,7 +9,7 @@ defaults: &defaults site_terms: '' site_contact_username: '' site_contact_email: '' - registrations_mode: 'none' + registrations_mode: 'none' # if you had changed this, check out `db/migrate/20240219170215_save_default_registrations_mode.rb` profile_directory: true closed_registrations_message: '' timeline_preview: true diff --git a/db/migrate/20240219170215_save_default_registrations_mode.rb b/db/migrate/20240219170215_save_default_registrations_mode.rb new file mode 100644 index 00000000000000..43a200a707b03b --- /dev/null +++ b/db/migrate/20240219170215_save_default_registrations_mode.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class SaveDefaultRegistrationsMode < ActiveRecord::Migration[7.1] + class MigrationSetting < ApplicationRecord + self.table_name = :settings + end + + def up + MigrationSetting.create!(thing_id: nil, thing_type: nil, var: 'registrations_mode', value: "--- open\n") unless MigrationSetting.exists?(thing_id: nil, thing_type: nil, var: 'registrations_mode') + end + + def down; end +end diff --git a/db/schema.rb b/db/schema.rb index 50f4e7189dfee1..80a481074d88b6 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_01_11_033014) do +ActiveRecord::Schema[7.1].define(version: 2024_02_19_170215) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index 935f6d24a38eaa..f90dc14accf17c 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -105,6 +105,11 @@ namespace :tests do exit(1) end + unless Setting.registrations_mode == 'open' + puts "Unexpected registrations mode: #{Setting.registrations_mode}" + exit(1) + end + puts 'No errors found. Database state is consistent with a successful migration process.' end