From edf3af4cb70643aa203f574637c1b2a09bda3e68 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 8 Sep 2026 21:29:17 -0600 Subject: [PATCH 1/3] docs: remove stale whitespace-drift example from schema-drift page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lsif_data_docs_search_private_delete example showed migrator reporting a space-vs-newline difference in a function definition. Since sourcegraph/sourcegraph f9b273e (May 2023), function definitions are whitespace-normalized before comparison, so this drift can no longer be reported. The example also used the old 'replace the function definition' wording and the old ❌ prefix, and its pasted output was hard-wrapped mid-token. Amp-Thread-ID: https://ampcode.com/threads/T-01a08426-e0ec-71d9-a4b9-bcf3deaa2890 Co-authored-by: Amp --- .../updates/migrator/schema-drift.mdx | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/docs/self-hosted/updates/migrator/schema-drift.mdx b/docs/self-hosted/updates/migrator/schema-drift.mdx index cba2fc882..f8c2cfc43 100644 --- a/docs/self-hosted/updates/migrator/schema-drift.mdx +++ b/docs/self-hosted/updates/migrator/schema-drift.mdx @@ -59,34 +59,4 @@ kubectl -n ns-sourcegraph exec -it pgsql -- psql -U sg -c 'ALTER TABLE external_ Then check the database again with the `drift` command and proceed with your multiversion upgrade. -> Note: It is possible for the drift command to detect diffs which will not prevent upgrades. For example the following drift output picked up formatting differences `\n` vs `""`: - -``` -❌ Unexpected definition of function "lsif_data_docs_search_private_delete" -strings.Join({ - "CREATE OR REPLACE FUNCTION -public.lsif_data_docs_search_private_", - "delete()\n RETURNS trigger\n LANGUAGE plpgsql\nAS -$function$\nBEGIN\n", - "UPDATE lsif_data_apidocs_num_search_results_private SET -count =", -- " ", -+ "\n", - "count - (select count(*) from oldtbl);\nRETURN NULL;\nEND -$functio", - "n$\n", - }, "") -💡 Suggested action: replace the function definition. -CREATE OR REPLACE FUNCTION -public.lsif_data_docs_search_private_delete() - RETURNS trigger - LANGUAGE plpgsql -AS $function$ -BEGIN -UPDATE lsif_data_apidocs_num_search_results_private SET count = -count - (select count(*) from oldtbl); -RETURN NULL; -END $function$; -``` - If migrator drift suggests SQL queries which don't make sense please report to support@sourcegraph.com. You may proceed with a migrator `upgrade` command using the `-skip-drift-check=true` flag. From c59bc529b98e39552552be5d19cca94fb4306bfc Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 8 Sep 2026 21:35:59 -0600 Subject: [PATCH 2/3] docs: refresh schema-drift examples to current migrator output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - EmojiFailure is now ' ⨯' (was ❌); migrator banner uses ✱ - Column drift with a targeted fix now says 'alter the column' and prints only the ALTER statement, not a go-cmp struct diff - Drift command prints a single 'Drift detected!' preamble - Upgrade-time hint now links to the schema-drift docs page - Unwrap hard-wrapped SQL so statements match what migrator prints Amp-Thread-ID: https://ampcode.com/threads/T-01a08426-e0ec-71d9-a4b9-bcf3deaa2890 Co-authored-by: Amp --- .../updates/migrator/schema-drift.mdx | 37 +++++-------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/docs/self-hosted/updates/migrator/schema-drift.mdx b/docs/self-hosted/updates/migrator/schema-drift.mdx index f8c2cfc43..445137f61 100644 --- a/docs/self-hosted/updates/migrator/schema-drift.mdx +++ b/docs/self-hosted/updates/migrator/schema-drift.mdx @@ -5,9 +5,9 @@ During an upgrade you may run into the following message. ``` -* Sourcegraph migrator v4.1.3 -❌ Schema drift detected for frontend -💡 Before continuing with this operation, run the migrator's drift command and follow instructions to repair the schema to the expected current state. +✱ Sourcegraph migrator 6.3.0 + ⨯ Schema drift detected for frontend +💡 Before continuing with this operation, run the migrator's drift command and follow instructions to repair the schema to the expected current state. See https://sourcegraph.com/docs/admin/updates/migrator/schema-drift for additional instructions. ``` This error indicates that `migrator` has detected some difference between the state of the schema in your database and the expected schema for the database in the `-from` or current version of your Sourcegraph instance. @@ -15,32 +15,15 @@ This error indicates that `migrator` has detected some difference between the st When the schema [drift](/self-hosted/updates/migrator/migrator-operations#drift) command is run you'll see a set of diffs representing the areas where your instance schema has diverged from the expected state as well as the SQL operations to fix these examples of drift. For example: ``` -❌ Missing index "external_service_repos"."external_service_repos_repo_id_external_service_id_unique" -💡 Suggested action: define the index. - -ALTER TABLE external_service_repos ADD CONSTRAINT -external_service_repos_repo_id_external_service_id_unique UNIQUE -(repo_id, external_service_id); -``` + ⨯ Drift detected! -``` -❌ Unexpected properties of column "batch_spec_resolution_jobs"."batch_spec_id" - -schemas.ColumnDescription{ - Name: "batch_spec_id", - Index: -1, - TypeName: "integer", -- IsNullable: false, -+ IsNullable: true, - Default: "", - CharacterMaximumLength: 0, - ... // 5 identical fields - } - -💡 Suggested action: change the column nullability constraint. + ⨯ Missing index "external_service_repos"."external_service_repos_repo_id_external_service_id_unique" +💡 Suggested action: define the index. +ALTER TABLE external_service_repos ADD CONSTRAINT external_service_repos_repo_id_external_service_id_unique UNIQUE (repo_id, external_service_id); -ALTER TABLE batch_spec_resolution_jobs ALTER COLUMN -batch_spec_id SET NOT NULL; + ⨯ Unexpected properties of column batch_spec_resolution_jobs."batch_spec_id" +💡 Suggested action: alter the column. +ALTER TABLE batch_spec_resolution_jobs ALTER COLUMN batch_spec_id SET NOT NULL; ``` To correct these errors in the database run the suggested SQL queries via `psql` in internal databases, or via the tools provided by your cloud database provider. From d4d0e7b5e6e2f6261bf8d88fa58845898c1c8edf Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 8 Sep 2026 21:44:18 -0600 Subject: [PATCH 3/3] docs: use current release version in migrator banner example Amp-Thread-ID: https://ampcode.com/threads/T-01a08426-e0ec-71d9-a4b9-bcf3deaa2890 Co-authored-by: Amp --- docs/self-hosted/updates/migrator/schema-drift.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/self-hosted/updates/migrator/schema-drift.mdx b/docs/self-hosted/updates/migrator/schema-drift.mdx index 445137f61..34abbdab2 100644 --- a/docs/self-hosted/updates/migrator/schema-drift.mdx +++ b/docs/self-hosted/updates/migrator/schema-drift.mdx @@ -5,7 +5,7 @@ During an upgrade you may run into the following message. ``` -✱ Sourcegraph migrator 6.3.0 +✱ Sourcegraph migrator 7.7.359 ⨯ Schema drift detected for frontend 💡 Before continuing with this operation, run the migrator's drift command and follow instructions to repair the schema to the expected current state. See https://sourcegraph.com/docs/admin/updates/migrator/schema-drift for additional instructions. ```