discourse/plugins/discourse-data-explorer/db/migrate
David Taylor 4e7578b76e
DEV: Check & resolve sequence issues during db:check_structure_dump (#40118)
As with rows, database sequence values are not persisted in
`structure.sql`. This commit adds a new check which detects any sequence
values introduced by migrations, and throws an error.

Existing issues are fixes up:
1. `enable_bookmarks_with_reminders` was being inserted and removed from
site settings unnecessarily. Removed.

2. user_associated_accounts and data_explorer_queries were having their
sequences updated unnecessarily on empty databases. Updated them to be
conditional.

3. Groups PK had been modified in a couple of different ways. A new
migration normalizes the start & current values to `40`, matching the
current behaviour

4. Badges PK was intended to START_AT 100. However, seed_fu/activerecord
were resetting the sequence to a lower number than that. A before_save
hook on the model already exists to work around that problem. Added a
migration to reset the sequence STARTS AT to 1, to make it clear that it
has no effect and we're relying on the model layer.

5. Flags PK STARTS_AT was already fixed in
`67305dc7bb`. This migration just
normalizes the current value, to fix up any sites which may have been
deployed with the `structure.sql` over the last few days
2026-05-18 15:23:41 +01:00
..
20200810053843_create_data_explorer_queries.rb DEV: Check & resolve sequence issues during db:check_structure_dump (#40118) 2026-05-18 15:23:41 +01:00
20200902225712_fix_query_ids.rb
20230227102505_rename_data_explorer_namespace.rb
20241009161603_alter_query_id_to_bigint.rb
20260316071737_rename_data_explorer_api_key_scope_resource.rb