Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(tenancy): add db_label to schema (#132)
p0nya56a7052f718
diff --git a/store/migration/10001__init_schema.sql b/store/migration/10001__init_schema.sqlindex db0c19376e..e2cec0cac3 100644--- a/store/migration/10001__init_schema.sql+++ b/store/migration/10001__init_schema.sql@@ -1301,6 +1301,41 @@ WHEREEND;+-- db_label stores labels asscociated with databases.+CREATE TABLE db_label (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ row_status TEXT NOT NULL CHECK (+ row_status IN ('NORMAL', 'ARCHIVED')+ ) DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),+ database_id INTEGER NOT NULL UNIQUE REFERENCES db (id),+ key TEXT NOT NULL REFERENCES label_key (key),+ value TEXT NOT NULL+);++CREATE UNIQUE INDEX idx_db_label_database_id_key ON db_label(database_id, key);++INSERT INTO+ sqlite_sequence (name, seq)+VALUES+ ('db_label', 100);++CREATE TRIGGER IF NOT EXISTS `trigger_update_db_label_modification_time`+AFTER+UPDATE+ ON `db_label` FOR EACH ROW BEGIN+UPDATE+ `db_label`+SET+ updated_ts = (strftime('%s', 'now'))+WHERE+ rowid = old.rowid;++END;+-- Deployment Configuration.-- deployment_config stores deployment configurations at project level.CREATE TABLE deployment_config (@@ -1335,4 +1370,4 @@ SETWHERErowid = old.rowid;-END;\ No newline at end of file+END;diff --git a/store/seed/test/10000__reset.sql b/store/seed/test/10000__reset.sqlindex 1613582da9..b7b67b1a98 100644--- a/store/seed/test/10000__reset.sql+++ b/store/seed/test/10000__reset.sql@@ -89,6 +89,9 @@ DELETE FROMDELETE FROMlabel_key;+DELETE FROM+ db_label;+DELETE FROMdeployment_config;