Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Change "SQL" type to "MIGRATE" type in mysql_migraiton_history table
天舟7237cabd13ff
diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex 632ed6e917..6cd9f48c10 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -109,7 +109,7 @@ type MigrationType stringconst (Baseline MigrationType = "BASELINE"- Sql MigrationType = "SQL"+ Migrate MigrationType = "MIGRATE"Branch MigrationType = "BRANCH")@@ -117,8 +117,8 @@ func (e MigrationType) String() string {switch e {case Baseline:return "BASELINE"- case Sql:- return "SQL"+ case Migrate:+ return "MIGRATE"case Branch:return "BRANCH"}@@ -168,7 +168,7 @@ func ParseMigrationInfo(fullPath string, baseDir string) (*MigrationInfo, error)Environment: parentDir,}- migrationType := Sql+ migrationType := Migratedescription := ""if len(parts) > 2 {if parts[2] == "baseline" {diff --git a/plugin/db/mysql.go b/plugin/db/mysql.goindex 488f00a238..99403e1042 100644--- a/plugin/db/mysql.go+++ b/plugin/db/mysql.go@@ -487,7 +487,7 @@ func (driver *MySQLDriver) ExecuteMigration(ctx context.Context, m *MigrationInf}// VCS based SQL migration requires existing baselining- requireBaseline := m.Engine == VCS && m.Type == Sql+ requireBaseline := m.Engine == VCS && m.Type == Migratesequence, err := findNextSequence(ctx, tx, m.Namespace, requireBaseline)if err != nil {return errdiff --git a/plugin/db/mysql_migration_schema.sql b/plugin/db/mysql_migration_schema.sqlindex fd8ad50a46..5c8d3315b3 100644--- a/plugin/db/mysql_migration_schema.sql+++ b/plugin/db/mysql_migration_schema.sql@@ -53,7 +53,7 @@ CREATE TABLE bytebase.migration_history (sequence INTEGER UNSIGNED NOT NULL,-- We call it engine because maybe we could load history from other migration tool.`engine` ENUM('UI', 'VCS') NOT NULL,- `type` ENUM('BASELINE', 'SQL', 'BRANCH') NOT NULL,+ `type` ENUM('BASELINE', 'MIGRATE', 'BRANCH') NOT NULL,version TEXT NOT NULL,description TEXT NOT NULL,-- Recorded the migration statementdiff --git a/server/task_executor_schema_update.go b/server/task_executor_schema_update.goindex c5215012fe..4e0f9904ca 100644--- a/server/task_executor_schema_update.go+++ b/server/task_executor_schema_update.go@@ -46,7 +46,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve}mi := &db.MigrationInfo{- Type: db.Sql,+ Type: db.Migrate,}if payload.VCSPushEvent == nil {mi.Engine = db.UI