mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:11:57 +00:00
[Backport 5.5.x] release/bug: generate a new stitched migration graph (#63769)
This will correct6 upgrade path for mvu plan creation
## Test plan
CI test
## Changelog
<br> Backport cb19d6f0a9 from #63764
Co-authored-by: Warren Gifford <warren@sourcegraph.com>
This commit is contained in:
parent
344169fd47
commit
8ee41490b9
@ -501,7 +501,7 @@ load("//dev:schema_migrations.bzl", "schema_migrations")
|
||||
|
||||
schema_migrations(
|
||||
name = "schemas_migrations",
|
||||
updated_at = "2024-07-10 22:05",
|
||||
updated_at = "2024-07-10 23:24",
|
||||
)
|
||||
|
||||
# wolfi images setup ================================
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
// NOTE: This should be kept up-to-date with the upcoming version to be released, and bumped after.
|
||||
// fallback schemas everything we support migrating to. The release tool automates this upgrade, so don't touch this :)
|
||||
// This should be the last minor version since patch releases only happen in the release branch.
|
||||
const maxVersionString = "5.4.0"
|
||||
const maxVersionString = "5.5.0"
|
||||
|
||||
// MaxVersion is the highest known released version at the time the migrator was built.
|
||||
var MaxVersion = func() oobmigration.Version {
|
||||
|
||||
@ -692,6 +692,19 @@
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1719914228,
|
||||
"Name": "insight_series_modify_query",
|
||||
"UpQuery": "ALTER TABLE insight_series ADD COLUMN IF NOT EXISTS query_old TEXT;\nUPDATE insight_series SET query_old = query;\n\n-- prefix query with patternType:standard if there is no patterntype: in the query\nUPDATE insight_series\nSET query = 'patterntype:standard ' || query\nWHERE query NOT ILIKE '%patterntype:%'\n -- exclude empty queries, which are created by language stats insights\n AND query != '';\n\nCOMMENT ON COLUMN insight_series.query_old IS 'Backup for migration. Remove with release 5.6 or later.';",
|
||||
"DownQuery": "DO\n$$\n BEGIN\n -- Check if column 'query_old' exists\n IF EXISTS (SELECT 1\n FROM information_schema.columns\n WHERE table_name = 'insight_series' AND column_name = 'query_old') THEN\n -- Update the 'query' column with values from 'query_old'\n UPDATE insight_series SET query = query_old;\n ALTER TABLE insight_series DROP COLUMN query_old;\n END IF;\n END\n$$;",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1679051112
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
}
|
||||
],
|
||||
"BoundsByRev": {
|
||||
@ -933,6 +946,13 @@
|
||||
1679051112
|
||||
],
|
||||
"PreCreation": false
|
||||
},
|
||||
"v5.5.0": {
|
||||
"RootID": 1000000027,
|
||||
"LeafIDs": [
|
||||
1719914228
|
||||
],
|
||||
"PreCreation": false
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1909,6 +1929,13 @@
|
||||
1686315964
|
||||
],
|
||||
"PreCreation": false
|
||||
},
|
||||
"v5.5.0": {
|
||||
"RootID": 1000000033,
|
||||
"LeafIDs": [
|
||||
1686315964
|
||||
],
|
||||
"PreCreation": false
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -11221,6 +11248,85 @@
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1717699555,
|
||||
"Name": "Fix unique index for SCIM external account connection",
|
||||
"UpQuery": "DROP INDEX IF EXISTS user_external_accounts_user_id_scim_service_type;\n\nCREATE UNIQUE INDEX\n user_external_accounts_user_id_scim_service_type\nON\n user_external_accounts (user_id, service_type)\nWHERE\n service_type = 'scim'::text\n AND deleted_at IS NULL;",
|
||||
"DownQuery": "DROP INDEX IF EXISTS user_external_accounts_user_id_scim_service_type;\n\nCREATE UNIQUE INDEX\n user_external_accounts_user_id_scim_service_type\nON\n user_external_accounts (user_id, service_type)\nWHERE\n service_type = 'scim'::text;",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1713958707
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1719214941,
|
||||
"Name": "notebooks_add_field_pattern_type",
|
||||
"UpQuery": "DO $$\nBEGIN\n IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'pattern_type') THEN\n CREATE TYPE pattern_type AS ENUM ('keyword', 'literal', 'regexp', 'standard', 'structural');\n END IF;\nEND\n$$;\n\nALTER TABLE notebooks ADD COLUMN IF NOT EXISTS pattern_type pattern_type NOT NULL DEFAULT 'standard';",
|
||||
"DownQuery": "ALTER TABLE notebooks DROP COLUMN IF EXISTS pattern_type;\nDROP TYPE IF EXISTS pattern_type;",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1717699555
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1719498032,
|
||||
"Name": "add_github_app_batch_changes_site_credential",
|
||||
"UpQuery": "ALTER TABLE IF EXISTS batch_changes_site_credentials\n ADD COLUMN IF NOT EXISTS github_app_id INT NULL REFERENCES github_apps(id) ON DELETE CASCADE;\n\nALTER TABLE batch_changes_site_credentials DROP CONSTRAINT IF EXISTS check_github_app_id_and_external_service_type_site_credentials;\n\n-- We want to make sure that we never have a site_credential with a `github_app_id` with an `external_service_type`\n-- that isn't `github`.\nALTER TABLE IF EXISTS batch_changes_site_credentials\n ADD CONSTRAINT check_github_app_id_and_external_service_type_site_credentials\n CHECK ((github_app_id IS NULL) OR (external_service_type = 'github'));",
|
||||
"DownQuery": "-- delete the constraints\nALTER TABLE IF EXISTS batch_changes_site_credentials DROP CONSTRAINT IF EXISTS check_github_app_id_and_external_service_type_site_credentials;\n\n-- delete the `github_app_id` column\nALTER TABLE IF EXISTS batch_changes_site_credentials DROP COLUMN IF EXISTS github_app_id;",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1717699555
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1719498091,
|
||||
"Name": "add_github_app_id_user_credentials",
|
||||
"UpQuery": "ALTER TABLE IF EXISTS user_credentials\n ADD COLUMN IF NOT EXISTS github_app_id INT NULL REFERENCES github_apps(id) ON DELETE CASCADE;\n\nALTER TABLE user_credentials DROP CONSTRAINT IF EXISTS check_github_app_id_and_external_service_type_user_credentials;\n\n-- We want to make sure that we never have a user_credential with a `github_app_id` with an `external_service_type`\n-- that isn't `github`.\nALTER TABLE IF EXISTS user_credentials\n ADD CONSTRAINT check_github_app_id_and_external_service_type_user_credentials\n CHECK ((github_app_id IS NULL) OR (external_service_type = 'github'));",
|
||||
"DownQuery": "-- delete the constraints\nALTER TABLE IF EXISTS user_credentials DROP CONSTRAINT IF EXISTS check_github_app_id_and_external_service_type_user_credentials;\n\n-- delete the `github_app_id` column\nALTER TABLE IF EXISTS user_credentials DROP COLUMN IF EXISTS github_app_id;",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1719498032
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1719498128,
|
||||
"Name": "add_kind_column_github_app",
|
||||
"UpQuery": "DO $$\nBEGIN\n IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'github_app_kind') THEN\n CREATE TYPE github_app_kind AS ENUM (\n 'COMMIT_SIGNING',\n 'REPO_SYNC',\n 'USER_CREDENTIAL',\n 'SITE_CREDENTIAL'\n );\n END IF;\nEND\n$$;\n\nALTER TABLE IF EXISTS github_apps\n ADD COLUMN IF NOT EXISTS kind github_app_kind DEFAULT 'REPO_SYNC';\n\nUPDATE github_apps\nSET kind = 'COMMIT_SIGNING'\nWHERE domain = 'batches';\n\n-- This is expected to fail if any row is using an unknown value that is not repos or batches.\n-- We only allow repos or batches at this time.\nALTER TABLE IF EXISTS github_apps\nALTER COLUMN kind SET NOT NULL;",
|
||||
"DownQuery": "ALTER TABLE IF EXISTS github_apps DROP COLUMN IF EXISTS kind;\n\nDROP TYPE IF EXISTS github_app_kind;",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1719498091
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
},
|
||||
{
|
||||
"ID": 1720165387,
|
||||
"Name": "notebooks default to keyword search",
|
||||
"UpQuery": "ALTER TABLE IF EXISTS notebooks ALTER COLUMN pattern_type SET DEFAULT 'keyword';",
|
||||
"DownQuery": "ALTER TABLE IF EXISTS notebooks ALTER COLUMN pattern_type SET DEFAULT 'standard';",
|
||||
"Privileged": false,
|
||||
"NonIdempotent": false,
|
||||
"Parents": [
|
||||
1719214941,
|
||||
1719498128
|
||||
],
|
||||
"IsCreateIndexConcurrently": false,
|
||||
"IndexMetadata": null
|
||||
}
|
||||
],
|
||||
"BoundsByRev": {
|
||||
@ -11484,6 +11590,13 @@
|
||||
1713958707
|
||||
],
|
||||
"PreCreation": false
|
||||
},
|
||||
"v5.5.0": {
|
||||
"RootID": 1648051770,
|
||||
"LeafIDs": [
|
||||
1720165387
|
||||
],
|
||||
"PreCreation": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user