diff --git a/db/migrate/20251002140103_migrate_timeline_preview_setting.rb b/db/migrate/20251002140103_migrate_timeline_preview_setting.rb index 4d180bd8f3..9a18a6451c 100644 --- a/db/migrate/20251002140103_migrate_timeline_preview_setting.rb +++ b/db/migrate/20251002140103_migrate_timeline_preview_setting.rb @@ -12,8 +12,7 @@ class MigrateTimelinePreviewSetting < ActiveRecord::Migration[8.0] Setting.upsert_all( %w(local_live_feed_access remote_live_feed_access local_topic_feed_access remote_topic_feed_access).map do |var| { var: var, value: value ? "--- public\n" : "--- authenticated\n" } - end, - unique_by: :var + end ) end diff --git a/db/migrate/20251023210145_migrate_landing_page_setting.rb b/db/migrate/20251023210145_migrate_landing_page_setting.rb index 0067e17185..e8448bc75e 100644 --- a/db/migrate/20251023210145_migrate_landing_page_setting.rb +++ b/db/migrate/20251023210145_migrate_landing_page_setting.rb @@ -9,10 +9,10 @@ class MigrateLandingPageSetting < ActiveRecord::Migration[8.0] value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol]) - Setting.upsert( + Setting.upsert({ var: 'landing_page', - value: value ? "--- trends\n" : "--- about\n" - ) + value: value ? "--- trends\n" : "--- about\n", + }) end def down; end diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index 9385e390de..0c5c6a09ca 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -144,6 +144,16 @@ namespace :tests do exit(1) end + unless Setting.landing_page == 'about' + puts 'Landing page settings not migrated as expected' + exit(1) + end + + unless Setting.local_live_feed_access == 'authenticated' + puts 'Local live feed access not migrated as expected' + exit(1) + end + puts 'No errors found. Database state is consistent with a successful migration process.' end @@ -162,6 +172,13 @@ namespace :tests do (1, 'https://example.com/users/foobar', 'foobar@example.com', now(), now()), (1, 'https://example.com/users/foobar', 'foobar@example.com', now(), now()); + /* trends_as_landing_page is technically not a 3.3.0 setting, but it's easier to just add it here */ + INSERT INTO "settings" + (id, thing_type, thing_id, var, value, created_at, updated_at) + VALUES + (7, NULL, NULL, 'timeline_preview', E'--- false\n', now(), now()), + (8, NULL, NULL, 'trends_as_landing_page', E'--- false\n', now(), now()); + /* Doorkeeper records While the `read:me` scope was technically not valid in 3.3.0, it is still useful for the purposes of testing the `ChangeReadMeScopeToProfile`