From 3776c00377467d80dfb7ae19bcdef5d92935af33 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 9 Sep 2021 08:11:17 +0200 Subject: [PATCH] change column WIP --- integration-tests/engines.js | 8 ++++---- packages/tools/src/alterPlan.ts | 3 ++- packages/types/dialect.d.ts | 1 + plugins/dbgate-plugin-mssql/src/frontend/driver.js | 1 + plugins/dbgate-plugin-mysql/src/frontend/drivers.js | 1 + plugins/dbgate-plugin-postgres/src/frontend/drivers.js | 1 + 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/integration-tests/engines.js b/integration-tests/engines.js index b11d40cb..bbaa86ad 100644 --- a/integration-tests/engines.js +++ b/integration-tests/engines.js @@ -116,11 +116,11 @@ const engines = [ const filterLocal = [ // filter local testing - 'MySQL', - 'PostgreSQL', + '-MySQL', + '-PostgreSQL', 'SQL Server', - 'SQLite', - 'CockroachDB', + '-SQLite', + '-CockroachDB', ]; module.exports = process.env.CITEST diff --git a/packages/tools/src/alterPlan.ts b/packages/tools/src/alterPlan.ts index f86ff64c..b705b811 100644 --- a/packages/tools/src/alterPlan.ts +++ b/packages/tools/src/alterPlan.ts @@ -233,7 +233,8 @@ export class AlterPlan { this._testTableRecreate(op, 'createColumn', this.dialect.createColumn, 'newObject') || this._testTableRecreate(op, 'dropColumn', this.dialect.dropColumn, 'oldObject') || this._testTableRecreate(op, 'createConstraint', obj => this._canCreateConstraint(obj), 'newObject') || - this._testTableRecreate(op, 'dropConstraint', obj => this._canDropConstraint(obj), 'oldObject') || [op] + this._testTableRecreate(op, 'dropConstraint', obj => this._canDropConstraint(obj), 'oldObject') || + this._testTableRecreate(op, 'changeColumn', this.dialect.changeColumn, 'newObject') || [op] ); }); diff --git a/packages/types/dialect.d.ts b/packages/types/dialect.d.ts index 2be14293..90597b34 100644 --- a/packages/types/dialect.d.ts +++ b/packages/types/dialect.d.ts @@ -19,6 +19,7 @@ export interface SqlDialect { createColumn?: boolean; dropColumn?: boolean; + changeColumn?: boolean; createIndex?: boolean; dropIndex?: boolean; createForeignKey?: boolean; diff --git a/plugins/dbgate-plugin-mssql/src/frontend/driver.js b/plugins/dbgate-plugin-mssql/src/frontend/driver.js index 6162a7ba..608228ab 100644 --- a/plugins/dbgate-plugin-mssql/src/frontend/driver.js +++ b/plugins/dbgate-plugin-mssql/src/frontend/driver.js @@ -22,6 +22,7 @@ const dialect = { createColumn: true, dropColumn: true, + changeColumn: true, createIndex: true, dropIndex: true, createForeignKey: true, diff --git a/plugins/dbgate-plugin-mysql/src/frontend/drivers.js b/plugins/dbgate-plugin-mysql/src/frontend/drivers.js index 11eb28f5..74204ea9 100644 --- a/plugins/dbgate-plugin-mysql/src/frontend/drivers.js +++ b/plugins/dbgate-plugin-mysql/src/frontend/drivers.js @@ -16,6 +16,7 @@ const dialect = { createColumn: true, dropColumn: true, + changeColumn: true, createIndex: true, dropIndex: true, createForeignKey: true, diff --git a/plugins/dbgate-plugin-postgres/src/frontend/drivers.js b/plugins/dbgate-plugin-postgres/src/frontend/drivers.js index 67a8e92b..d7262cde 100644 --- a/plugins/dbgate-plugin-postgres/src/frontend/drivers.js +++ b/plugins/dbgate-plugin-postgres/src/frontend/drivers.js @@ -19,6 +19,7 @@ const dialect = { createColumn: true, dropColumn: true, + changeColumn: true, createIndex: true, dropIndex: true, createForeignKey: true,