Skip to content

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

chore: remove resource type enum (#15209)

Danny Xu9361a9bc2906
diff --git a/backend/migrator/migration/3.4/0011##resource_type_enum.sql b/backend/migrator/migration/3.4/0011##resource_type_enum.sql
new file mode 100644
index 0000000000..81ade7357d
--- /dev/null
+++ b/backend/migrator/migration/3.4/0011##resource_type_enum.sql
@@ -0,0 +1,3 @@
+ALTER TABLE policy ALTER COLUMN resource_type TYPE text;
+DROP TYPE resource_type;
+ALTER TABLE policy ADD CONSTRAINT resource_type_type CHECK (resource_type IN ('WORKSPACE', 'ENVIRONMENT', 'PROJECT', 'INSTANCE'));
\ No newline at end of file
diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sql
index 83005a8958..58ace734c5 100644
--- a/backend/migrator/migration/LATEST.sql
+++ b/backend/migrator/migration/LATEST.sql
@@ -71,16 +71,14 @@ ALTER SEQUENCE environment_id_seq RESTART WITH 101;
-- Policy
-- policy stores the policies for each resources.
-CREATE TYPE resource_type AS ENUM ('WORKSPACE', 'ENVIRONMENT', 'PROJECT', 'INSTANCE', 'DATABASE');
-
CREATE TABLE policy (
id serial PRIMARY KEY,
row_status row_status NOT NULL DEFAULT 'NORMAL',
updated_at timestamptz NOT NULL DEFAULT now(),
+ resource_type text NOT NULL CHECK (resource_type IN ('WORKSPACE', 'ENVIRONMENT', 'PROJECT', 'INSTANCE')),
+ resource TEXT NOT NULL,
type text NOT NULL CHECK (type LIKE 'bb.policy.%'),
payload jsonb NOT NULL DEFAULT '{}',
- resource_type resource_type NOT NULL,
- resource TEXT NOT NULL,
inherit_from_parent boolean NOT NULL DEFAULT TRUE
);
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 7c387cb937..af31309ca5 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -212,5 +212,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.4.10"), releaseVersion)
+ require.Equal(t, semver.MustParse("3.4.11"), releaseVersion)
}