Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: migrate vcs type in payload (#6406)

p0ny15dd67f239c7
diff --git a/backend/migrator/migration/prod/2.2/0004##update_vcs_type_in_payload.sql b/backend/migrator/migration/prod/2.2/0004##update_vcs_type_in_payload.sql
new file mode 100644
index 0000000000..7aa33f552b
--- /dev/null
+++ b/backend/migrator/migration/prod/2.2/0004##update_vcs_type_in_payload.sql
@@ -0,0 +1,7 @@
+UPDATE task SET task.payload = jsonb_set(task.payload, '{pushEvent,vcsType}', '"GITLAB"') WHERE task.payload ? 'pushEvent' AND task.payload->'pushEvent'->>'vcsType' = 'GITLAB_SELF_HOST';
+
+UPDATE task SET task.payload = jsonb_set(task.payload, '{pushEvent,vcsType}', '"GITHUB"') WHERE task.payload ? 'pushEvent' AND task.payload->'pushEvent'->>'vcsType' = 'GITHUB_COM';
+
+UPDATE instance_change_history SET instance_change_history.payload = jsonb_set(instance_change_history.payload, '{pushEvent,vcsType}', '"GITLAB"') WHERE task.payload ? 'pushEvent' AND task.payload->'pushEvent'->>'vcsType' = 'GITLAB_SELF_HOST';
+
+UPDATE instance_change_history SET instance_change_history.payload = jsonb_set(instance_change_history.payload, '{pushEvent,vcsType}', '"GITHUB"') WHERE task.payload ? 'pushEvent' AND task.payload->'pushEvent'->>'vcsType' = 'GITHUB_COM';
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 102847572f..11789d9073 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -241,5 +241,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("2.2.3"), releaseVersion)
+ require.Equal(t, semver.MustParse("2.2.4"), releaseVersion)
}