diff --git a/plugin/db/clickhouse/clickhouse_migration_schema.sql b/plugin/db/clickhouse/clickhouse_migration_schema.sql index a4813332b083eb..dd7e0f3a5dada5 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.sql index 32f0285d70ed1b..1f0f2ba12535a9 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.sql index 507179635008dc..d8509fe5ba5447 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.sql index 5e5ec307a77bbc..71ba7f531b8fa9 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,