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: support ddl/dml aliasing for GitOps name template (#2570)
Danny Xu1e8b857640f4
diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex 02904732c6..7399a63fe5 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -296,10 +296,14 @@ func ParseMigrationInfo(filePath, filePathTemplate string) (*MigrationInfo, erroswitch matchList[index] {case "data":mi.Type = Data+ case "dml":+ mi.Type = Datacase "migrate":mi.Type = Migrate+ case "ddl":+ mi.Type = Migratedefault:- return nil, errors.Errorf("file path %q contains invalid migration type %q, must be 'migrate' or 'data'", filePath, matchList[index])+ return nil, errors.Errorf("file path %q contains invalid migration type %q, must be 'migrate'('ddl') or 'data'('dml')", filePath, matchList[index])}case "DESCRIPTION":mi.Description = matchList[index]diff --git a/plugin/db/driver_test.go b/plugin/db/driver_test.goindex 662a82b841..e450045e66 100644--- a/plugin/db/driver_test.go+++ b/plugin/db/driver_test.go@@ -106,6 +106,36 @@ func TestParseMigrationInfo(t *testing.T) {},wantErr: "",},+ {+ filePath: "db1__001foo__ddl",+ filePathTemplate: "{{DB_NAME}}__{{VERSION}}__{{TYPE}}",+ want: MigrationInfo{+ Version: "001foo",+ Namespace: "db1",+ Database: "db1",+ Environment: "",+ Source: VCS,+ Type: Migrate,+ Description: "Create db1 schema migration",+ Creator: "",+ },+ wantErr: "",+ },+ {+ filePath: "db1__001foo__dml",+ filePathTemplate: "{{DB_NAME}}__{{VERSION}}__{{TYPE}}",+ want: MigrationInfo{+ Version: "001foo",+ Namespace: "db1",+ Database: "db1",+ Environment: "",+ Source: VCS,+ Type: Data,+ Description: "Create db1 data change",+ Creator: "",+ },+ wantErr: "",+ },{filePath: "db_shop1__001foo__data",filePathTemplate: "{{DB_NAME}}__{{VERSION}}__{{TYPE}}",