discourse/spec/db/migrate
David Taylor 85693658ff
DEV: Move Community sidebar section + links from migrations to seed fixture (#39973)
Previously, the Community sidebar section, its 12 default URLs, and the
links binding them were inserted across four migrations
(`20230411032053_insert_community_to_sidebar_sections.rb`,
`20241025045928_add_invites_link_to_sidebar.rb`,
`20250626090725_add_my_messages_link_to_sidebar.rb`,
`20250721043317_add_filter_link_to_sidebar.rb`), mixing schema and data
and re-running data inserts every time a new link was added.

This change moves the rows to `db/fixtures/700_sidebar.rb`, gated by a
hidden `sidebar_seeded` site setting so admin customizations (renamed
links, reordering, even destroying the public Community section via
`sidebar_sections_controller#destroy`) survive subsequent `db:seed`
runs. The fixture iterates `SidebarUrl::COMMUNITY_SECTION_LINKS` so
adding a future link is a one-line model change plus a re-seed.

The four existing migrations are gated on `Migration::Helpers.new_site?`
so they continue to upgrade existing sites past the point the link
didn't yet exist, but no-op on fresh installs (where the fixture is the
source of truth). A companion
`20260513105516_mark_existing_sites_sidebar_seeded.rb` flips the flag
for existing sites so the seed bails immediately on the upgrade deploy.

Extracted from https://github.com/discourse/discourse/pull/39788.
2026-05-13 12:13:12 +01:00
..
.gitkeep
20250714010001_backfill_themeable_site_settings_spec.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
20250902072941_sync_timerable_id_topic_id_spec.rb
20251024015907_populate_image_quality_setting_spec.rb DEV: Force new_site? to true in PopulateImageQualitySetting fresh-install spec (#39972) 2026-05-13 11:51:09 +01:00
20260106060807_add_slug_to_tags_spec.rb DEV: Silence expected error/debug output in core specs (#39247) 2026-04-14 11:04:10 +02:00
20260319054026_add_posting_review_modes_to_category_settings_spec.rb FEATURE: Support group based category posting review modes (#38707) 2026-04-07 10:41:16 +08:00
20260513101242_mark_existing_sites_directory_columns_seeded_spec.rb DEV: Move automatic directory_columns rows from migration to seed fixture (#39970) 2026-05-13 12:12:56 +01:00
20260513105516_mark_existing_sites_sidebar_seeded_spec.rb DEV: Move Community sidebar section + links from migrations to seed fixture (#39973) 2026-05-13 12:13:12 +01:00