Skip to content

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

chore: add more null checks (#15038)

Danny Xuafdc8bb96a02
diff --git a/backend/migrator/migration/prod/3.3/0002##algorithm.sql b/backend/migrator/migration/prod/3.3/0002##algorithm.sql
index 690ee00ee4..3a21474027 100644
--- a/backend/migrator/migration/prod/3.3/0002##algorithm.sql
+++ b/backend/migrator/migration/prod/3.3/0002##algorithm.sql
@@ -16,15 +16,15 @@ algorithms_expanded AS (
transformed_algorithms AS (
SELECT jsonb_build_object(
'id', algorithm_record->>'id',
- 'title', algorithm_record->>'title',
- 'description', algorithm_record->>'description',
+ 'title', coalesce(algorithm_record->>'title', ''),
+ 'description', coalesce(algorithm_record->>'description', ''),
'algorithm', algorithm_record
) AS transformed_algorithm
FROM algorithms_expanded
),
combined_data AS (
SELECT
- jsonb_agg(ta.transformed_algorithm) || (SELECT coalesce(value::jsonb->'types', '[]'::jsonb) FROM setting WHERE name = 'bb.workspace.semantic-types') AS types_array
+ coalesce(jsonb_agg(ta.transformed_algorithm), '[]'::jsonb) || (SELECT coalesce(value::jsonb->'types', '[]'::jsonb) FROM setting WHERE name = 'bb.workspace.semantic-types') AS types_array
FROM transformed_algorithms ta
)
UPDATE setting
diff --git a/backend/migrator/migration/prod/3.3/0008##semantic_null.sql b/backend/migrator/migration/prod/3.3/0008##semantic_null.sql
new file mode 100644
index 0000000000..8aa7231f0b
--- /dev/null
+++ b/backend/migrator/migration/prod/3.3/0008##semantic_null.sql
@@ -0,0 +1 @@
+DELETE FROM setting where name = 'bb.workspace.semantic-types' AND value LIKE '%null%';
\ No newline at end of file
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 2a11eae5e1..6d306a3d21 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -231,5 +231,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.3.7"), releaseVersion)
+ require.Equal(t, semver.MustParse("3.3.8"), releaseVersion)
}