Skip to content

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

chore: add sheet_id to instance_change_history (#6702)

Danny Xu91fcd6946119
diff --git a/backend/migrator/migration/dev/LATEST.sql b/backend/migrator/migration/dev/LATEST.sql
index 1b58e968d0..1093f62746 100644
--- a/backend/migrator/migration/dev/LATEST.sql
+++ b/backend/migrator/migration/dev/LATEST.sql
@@ -790,8 +790,10 @@ CREATE TABLE instance_change_history (
-- Record the change version.
version TEXT NOT NULL,
description TEXT NOT NULL,
- -- Record the change statement
+ -- Record the change statement in preview format.
statement TEXT NOT NULL,
+ -- Record the sheet for the change statement. Optional.
+ sheet_id BIGINT NULL,
-- Record the schema after change
schema TEXT NOT NULL,
-- Record the schema before change. Though we could also fetch it from the previous change history, it would complicate fetching logic.
diff --git a/backend/migrator/migration/prod/2.3/0002##add_sheet_to_instance_change.sql b/backend/migrator/migration/prod/2.3/0002##add_sheet_to_instance_change.sql
new file mode 100644
index 0000000000..99c3d5b7c4
--- /dev/null
+++ b/backend/migrator/migration/prod/2.3/0002##add_sheet_to_instance_change.sql
@@ -0,0 +1 @@
+ALTER TABLE instance_change_history ADD COLUMN sheet_id BIGINT NULL;
diff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sql
index 585e6497e4..5a4d75c49c 100644
--- a/backend/migrator/migration/prod/LATEST.sql
+++ b/backend/migrator/migration/prod/LATEST.sql
@@ -789,8 +789,10 @@ CREATE TABLE instance_change_history (
-- Record the migration version.
version TEXT NOT NULL,
description TEXT NOT NULL,
- -- Record the migration statement
+ -- Record the change statement in preview format.
statement TEXT NOT NULL,
+ -- Record the sheet for the change statement. Optional.
+ sheet_id BIGINT NULL,
-- Record the schema after migration
schema TEXT NOT NULL,
-- Record the schema before migration. Though we could also fetch it from the previous migration history, it would complicate fetching logic.
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index ed9b4119f6..13c62431f0 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -244,5 +244,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("2.3.1"), releaseVersion)
+ require.Equal(t, semver.MustParse("2.3.2"), releaseVersion)
}