drop column ref works

This commit is contained in:
Jan Prochazka
2021-09-05 11:01:52 +02:00
parent 0ef5ac04d8
commit e79e19c614
3 changed files with 17 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ async function testTableDiff(conn, driver, mangle) {
// const TESTED_COLUMNS = ['col_pk', 'col_std', 'col_def', 'col_fk', 'col_ref', 'col_idx', 'col_uq']; // const TESTED_COLUMNS = ['col_pk', 'col_std', 'col_def', 'col_fk', 'col_ref', 'col_idx', 'col_uq'];
// const TESTED_COLUMNS = ['col_pk']; // const TESTED_COLUMNS = ['col_pk'];
// const TESTED_COLUMNS = ['col_idx']; // const TESTED_COLUMNS = ['col_idx'];
const TESTED_COLUMNS = ['col_uq']; const TESTED_COLUMNS = ['col_ref'];
// const TESTED_COLUMNS = ['col_std']; // const TESTED_COLUMNS = ['col_std'];
function engines_columns_source() { function engines_columns_source() {

View File

@@ -16,7 +16,6 @@ const matviews = {
const engines = [ const engines = [
{ {
label: 'MySQL', label: 'MySQL',
skipLocal: true,
connection: { connection: {
engine: 'mysql@dbgate-plugin-mysql', engine: 'mysql@dbgate-plugin-mysql',
password: 'Pwd2020Db', password: 'Pwd2020Db',
@@ -34,7 +33,6 @@ const engines = [
}, },
{ {
label: 'PostgreSQL', label: 'PostgreSQL',
skipLocal: true,
connection: { connection: {
engine: 'postgres@dbgate-plugin-postgres', engine: 'postgres@dbgate-plugin-postgres',
password: 'Pwd2020Db', password: 'Pwd2020Db',
@@ -69,7 +67,6 @@ const engines = [
}, },
{ {
label: 'SQL Server', label: 'SQL Server',
skipLocal: true,
connection: { connection: {
engine: 'mssql@dbgate-plugin-mssql', engine: 'mssql@dbgate-plugin-mssql',
password: 'Pwd2020Db', password: 'Pwd2020Db',
@@ -94,7 +91,6 @@ const engines = [
}, },
{ {
label: 'SQLite', label: 'SQLite',
// skipLocal: true,
generateDbFile: true, generateDbFile: true,
connection: { connection: {
engine: 'sqlite@dbgate-plugin-sqlite', engine: 'sqlite@dbgate-plugin-sqlite',
@@ -103,7 +99,6 @@ const engines = [
}, },
{ {
label: 'CockroachDB', label: 'CockroachDB',
skipLocal: true,
connection: { connection: {
engine: 'cockroach@dbgate-plugin-postgres', engine: 'cockroach@dbgate-plugin-postgres',
user: 'root', user: 'root',
@@ -119,4 +114,15 @@ const engines = [
}, },
]; ];
module.exports = process.env.CITEST ? engines.filter(x => !x.skipOnCI) : engines.filter(x => !x.skipLocal); const filterLocal = [
// filter local testing
'-MySQL',
'PostgreSQL',
'-SQL Server',
'-SQLite',
'CockroachDB',
];
module.exports = process.env.CITEST
? engines.filter(x => !x.skipOnCI)
: engines.filter(x => filterLocal.find(y => x.label == y));

View File

@@ -11,6 +11,7 @@ const dialect = {
fallbackDataType: 'varchar', fallbackDataType: 'varchar',
anonymousPrimaryKey: true, anonymousPrimaryKey: true,
enableConstraintsPerTable: true, enableConstraintsPerTable: true,
dropColumnDependencies: ['dependencies'],
quoteIdentifier(s) { quoteIdentifier(s) {
return '"' + s + '"'; return '"' + s + '"';
}, },
@@ -40,7 +41,7 @@ const postgresDriverBase = {
__analyserInternals: { __analyserInternals: {
refTableCond: '', refTableCond: '',
} },
}; };
/** @type {import('dbgate-types').EngineDriver} */ /** @type {import('dbgate-types').EngineDriver} */
@@ -64,12 +65,12 @@ const cockroachDriver = {
dialect: { dialect: {
...dialect, ...dialect,
materializedViews: true, materializedViews: true,
dropColumnDependencies: ['primaryKey'], dropColumnDependencies: ['primaryKey', 'dependencies'],
dropPrimaryKey: false, dropPrimaryKey: false,
}, },
__analyserInternals: { __analyserInternals: {
refTableCond: 'and fk.referenced_table_name = ref.table_name', refTableCond: 'and fk.referenced_table_name = ref.table_name',
} },
}; };
/** @type {import('dbgate-types').EngineDriver} */ /** @type {import('dbgate-types').EngineDriver} */