Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
test(advisor/pg): cover TABLE_REQUIRE_PK edge cases
rebelice272305923542
diff --git a/backend/plugin/advisor/pg/test/table_require_pk.yaml b/backend/plugin/advisor/pg/test/table_require_pk.yamlindex f3a23860f9..deb1f00464 100644--- a/backend/plugin/advisor/pg/test/table_require_pk.yaml+++ b/backend/plugin/advisor/pg/test/table_require_pk.yaml@@ -93,3 +93,41 @@line: 2column: 0endposition: null+- statement: ALTER TABLE public.no_index_table ADD COLUMN x INT+ changeType: 1+- statement: ALTER TABLE tech_book ADD COLUMN x INT+ changeType: 1+- statement: ALTER TABLE public.tech_book DROP CONSTRAINT old_pk+ changeType: 1+ want:+ - status: 2+ code: 601+ title: TABLE_REQUIRE_PK+ content: 'Table "public"."tech_book" requires PRIMARY KEY, related statement: "ALTER TABLE public.tech_book DROP CONSTRAINT old_pk"'+ startposition:+ line: 1+ column: 0+ endposition: null+- statement: |-+ DROP TABLE tech_book;+ CREATE TABLE tech_book(id INT, name TEXT);+ changeType: 1+ want:+ - status: 2+ code: 601+ title: TABLE_REQUIRE_PK+ content: 'Table "public"."tech_book" requires PRIMARY KEY, related statement: "CREATE TABLE tech_book(id INT, name TEXT)"'+ startposition:+ line: 2+ column: 0+ endposition: null+- statement: ALTER TABLE ghost_table ADD COLUMN x INT+ changeType: 1+- statement: |-+ ALTER TABLE no_index_table ADD PRIMARY KEY (col_a);+ ALTER TABLE no_index_table DROP CONSTRAINT no_index_table_pkey;+ changeType: 1+- statement: |-+ ALTER TABLE tech_book DROP CONSTRAINT old_pk;+ ALTER TABLE tech_book ADD PRIMARY KEY (id);+ changeType: 1