Skip to content

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

chore: handle null resourceContainer (#11239)

Danny Xu37e195c89115
diff --git a/backend/migrator/migration/prod/2.15/0004##activity_resource.sql b/backend/migrator/migration/prod/2.15/0004##activity_resource.sql
new file mode 100644
index 0000000000..9d51367b85
--- /dev/null
+++ b/backend/migrator/migration/prod/2.15/0004##activity_resource.sql
@@ -0,0 +1,3 @@
+ALTER TABLE activity ALTER resource_container SET DEFAULT '';
+ALTER TABLE activity ALTER resource_container SET NOT NULL;
+UPDATE activity SET resource_container = '' WHERE resource_container IS NULL;
diff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sql
index d7b905026a..ce06fecad9 100644
--- a/backend/migrator/migration/prod/LATEST.sql
+++ b/backend/migrator/migration/prod/LATEST.sql
@@ -784,7 +784,7 @@ CREATE TABLE activity (
created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
updater_id INTEGER NOT NULL REFERENCES principal (id),
updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
- resource_container TEXT,
+ resource_container TEXT NOT NULL DEFAULT '',
container_id INTEGER NOT NULL CHECK (container_id > 0),
type TEXT NOT NULL CHECK (type LIKE 'bb.%'),
level TEXT NOT NULL CHECK (level IN ('INFO', 'WARN', 'ERROR')),
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 2c5a2b7d1a..07b9daf4f7 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -230,5 +230,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("2.15.3"), releaseVersion)
+ require.Equal(t, semver.MustParse("2.15.4"), releaseVersion)
}