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: change migration history schema ENUM field to text field (#362)
tianzhoub5b82ca1f50c
diff --git a/plugin/db/clickhouse/clickhouse_migration_schema.sql b/plugin/db/clickhouse/clickhouse_migration_schema.sqlindex a4813332b0..dd7e0f3a5d 100644--- a/plugin/db/clickhouse/clickhouse_migration_schema.sql+++ b/plugin/db/clickhouse/clickhouse_migration_schema.sql@@ -20,11 +20,14 @@ CREATE TABLE bytebase.migration_history (-- Used to detect out of order migration together with 'namespace' and 'version' column.sequence INTEGER UNSIGNED NOT NULL,-- We call it engine because maybe we could load history from other migration tool.- `engine` ENUM('UI' = 0, 'VCS' = 1) NOT NULL,- `type` ENUM('BASELINE' = 0, 'MIGRATE' = 1, 'BRANCH' = 2, 'DATA' = 3) NOT NULL,+ -- Current allowed values are UI, VCS.+ `engine` TEXT NOT NULL,+ -- Current allowed values are BASELINE, MIGRATE, BRANCH, DATA.+ `type` TEXT NOT NULL,+ -- Current allowed values are PENDING, DONE, FAILED.-- MySQL runs DDL in its own transaction, so we can't record DDL and migration_history into a single transaction.-- Thus, we create a "PENDING" record before applying the DDL and update that record to "DONE" after applying the DDL.- `status` ENUM('PENDING' = 0, 'DONE' = 1, 'FAILED' = 2) NOT NULL,+ `status` TEXT NOT NULL,-- Record the migration version.version TEXT NOT NULL,description TEXT NOT NULL,diff --git a/plugin/db/mysql/mysql_migration_schema.sql b/plugin/db/mysql/mysql_migration_schema.sqlindex 32f0285d70..1f0f2ba125 100644--- a/plugin/db/mysql/mysql_migration_schema.sql+++ b/plugin/db/mysql/mysql_migration_schema.sql@@ -20,11 +20,14 @@ CREATE TABLE bytebase.migration_history (-- Used to detect out of order migration together with 'namespace' and 'version' column.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', 'MIGRATE', 'BRANCH', 'DATA') NOT NULL,+ -- Current allowed values are UI, VCS.+ `engine` TEXT NOT NULL,+ -- Current allowed values are BASELINE, MIGRATE, BRANCH, DATA.+ `type` TEXT NOT NULL,+ -- Current allowed values are PENDING, DONE, FAILED.-- MySQL runs DDL in its own transaction, so we can't record DDL and migration_history into a single transaction.-- Thus, we create a "PENDING" record before applying the DDL and update that record to "DONE" after applying the DDL.- `status` ENUM('PENDING', 'DONE', 'FAILED') NOT NULL,+ `status` TEXT NOT NULL,-- Record the migration version.version TEXT NOT NULL,description TEXT NOT NULL,diff --git a/plugin/db/pg/pg_migration_schema.sql b/plugin/db/pg/pg_migration_schema.sqlindex 5071796350..d8509fe5ba 100644--- a/plugin/db/pg/pg_migration_schema.sql+++ b/plugin/db/pg/pg_migration_schema.sql@@ -20,11 +20,14 @@ CREATE TABLE migration_history (-- Used to detect out of order migration together with 'namespace' and 'version' column.sequence INTEGER NOT NULL CHECK (sequence >= 0),-- We call it engine because maybe we could load history from other migration tool.- engine TEXT NOT NULL CHECK (engine in ('UI', 'VCS')),- type TEXT NOT NULL CHECK (type in ('BASELINE', 'MIGRATE', 'BRANCH', 'DATA')),+ -- Current allowed values are UI, VCS.+ engine TEXT NOT NULL,+ -- Current allowed values are BASELINE, MIGRATE, BRANCH, DATA.+ type TEXT NOT NULL,+ -- Current allowed values are PENDING, DONE, FAILED.-- PostgreSQL can't do cross database transaction, so we can't record DDL and migration_history into a single transaction.-- Thus, we create a "PENDING" record before applying the DDL and update that record to "DONE" after applying the DDL.- status TEXT NOT NULL CHECK (status in ('PENDING', 'DONE', 'FAILED')),+ status TEXT NOT NULL,-- Record the migration version.version TEXT NOT NULL,description TEXT NOT NULL,diff --git a/plugin/db/snowflake/snowflake_migration_schema.sql b/plugin/db/snowflake/snowflake_migration_schema.sqlindex 5e5ec307a7..71ba7f531b 100644--- a/plugin/db/snowflake/snowflake_migration_schema.sql+++ b/plugin/db/snowflake/snowflake_migration_schema.sql@@ -20,8 +20,11 @@ CREATE TABLE bytebase.public.migration_history (-- Used to detect out of order migration together with 'namespace' and 'version' column.sequence INTEGER NOT NULL,-- We call it engine because maybe we could load history from other migration tool.+ -- Current allowed values are UI, VCS.engine TEXT NOT NULL,+ -- Current allowed values are BASELINE, MIGRATE, BRANCH, DATA.type TEXT NOT NULL,+ -- Current allowed values are PENDING, DONE, FAILED.-- Snowflake runs DDL in its own transaction, so we can't record DDL and migration_history into a single transaction.-- Thus, we create a "PENDING" record before applying the DDL and update that record to "DONE" after applying the DDL.status TEXT NOT NULL,