diff --git a/config/environments/production.rb b/config/environments/production.rb index 49b7048fd3..2bcd29e7d9 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -161,5 +161,6 @@ config.active_record.dump_schema_after_migration = false # Enable HSTS in production mode + config.force_ssl = true config.ssl_options = { hsts: { preload: true, expires: 1.year, subdomains: true } } end diff --git a/db/data/20240125154727_add_help_center_setting.rb b/db/data/20240125154727_add_help_center_setting.rb new file mode 100644 index 0000000000..e57e227cde --- /dev/null +++ b/db/data/20240125154727_add_help_center_setting.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddHelpCenterSetting < ActiveRecord::Migration[7.1] + def up + setting = Setting.find_or_create_by(name: 'HelpCenter') + SiteSetting.find_or_create_by(setting:, value: 'Published', provider: 'greenlight') + + SiteSetting.find_or_create_by( + setting:, + value: '', + provider: 'greenlight' + ) + + Tenant.all.each do |tenant| + SiteSetting.find_or_create_by( + setting:, + value: '', + provider: tenant.name + ) + end + end + + def down + Setting.find_by(name: 'HelpCenter')&.destroy + SiteSetting.find_by(setting: Setting.find_by(name: 'HelpCenter')).destroy + end +end diff --git a/db/data_schema.rb b/db/data_schema.rb index e50c1ff1f4..5170c4ab41 100644 --- a/db/data_schema.rb +++ b/db/data_schema.rb @@ -1 +1 @@ -DataMigrate::Data.define(version: 20231213203353) +DataMigrate::Data.define(version: 20240125154727) diff --git a/db/migrate/20231218154727_add_help_center_setting.rb b/db/migrate/20231218154727_add_help_center_setting.rb deleted file mode 100644 index 49c26ecef9..0000000000 --- a/db/migrate/20231218154727_add_help_center_setting.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddHelpCenterSetting < ActiveRecord::Migration[7.1] - def up - Setting.create!(name: 'HelpCenter') unless Setting.exists?(name: 'HelpCenter') - - return if SiteSetting.exists?(setting: Setting.find_by(name: 'HelpCenter')) - - SiteSetting.create!( - setting: Setting.find_by(name: 'HelpCenter'), - value: '', - provider: 'greenlight' - ) - end - - def down - Setting.find_by(name: 'HelpCenter')&.destroy - SiteSetting.find_by(setting: Setting.find_by(name: 'HelpCenter')).destroy - end -end