Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: skip common backfill for bytebase's database and we should use the one in pg_engine instead (#1004)
Danny Xu233d70c1238a
diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.goindex 53f3b727f6..72964b24a0 100644--- a/plugin/db/pg/pg.go+++ b/plugin/db/pg/pg.go@@ -697,7 +697,9 @@ func (driver *Driver) FindMigrationHistoryList(ctx context.Context, find *db.Mig}history, err := util.FindMigrationHistoryList(ctx, query, params, driver, find, baseQuery)// TODO(d): remove this block once all existing customers all migrated to semantic versioning.- if err != nil {+ // Skip this backfill for bytebase's database "bb" with user "bb". We will use the one in pg_engine.go instead.+ isBytebaseDatabase := strings.Contains(driver.baseDSN, "user=bb") && strings.Contains(driver.baseDSN, "sslmode=disable host=/tmp port=")+ if err != nil && !isBytebaseDatabase {if !strings.Contains(err.Error(), "invalid stored version") {return nil, err}diff --git a/store/pg_engine.go b/store/pg_engine.goindex f67c1c55c1..f09fc28169 100644--- a/store/pg_engine.go+++ b/store/pg_engine.go@@ -132,12 +132,14 @@ func (db *DB) Open(ctx context.Context) (err error) {}// This migrates the CREATE DATABSAE record to semantic version format.// https://github.com/bytebase/bytebase/blob/release/v1.0.2/store/pg_engine.go#L251+ // This 1.0.0 should correspond to 1.0/0000__initial_schema.sql.if _, err := db.ExecContext(ctx, "UPDATE migration_history SET version = '0001.0000.0000-20210113000000' WHERE id = 1 AND version = '10000';"); err != nil {return err}// This migrates the initial schema migration to semantic version format.// https://github.com/bytebase/bytebase/blob/release/v1.0.2/store/pg_engine.go#L295- if _, err := db.ExecContext(ctx, "UPDATE migration_history SET version = '0001.0000.0000-20210113000001' WHERE id = 2 AND version = '10001';"); err != nil {+ // This 1.0.1 should correspond to 1.0/0001__initial_data.sql.+ if _, err := db.ExecContext(ctx, "UPDATE migration_history SET version = '0001.0000.0001-20210113000001' WHERE id = 2 AND version = '10001';"); err != nil {return err}}