SYNC: multi-sql

This commit is contained in:
SPRINX0\prochazka
2025-02-24 12:20:30 +01:00
committed by Diflow
parent 8bdd24aa1e
commit bdd9dc8c9d
27 changed files with 526 additions and 11 deletions

View File

@@ -92,11 +92,12 @@ const driver = {
? { ...mysqlSplitterOptions, ignoreComments: true, preventSingleLineSplit: true }
: mysqlSplitterOptions,
adaptTableInfo(table) {
if (!table.primaryKey && !table.sortingKey) {
const hasIdColumn = table.columns.some((x) => x.columnName == 'id');
const baseAdapted = driverBase.adaptTableInfo(table);
if (!baseAdapted.primaryKey && !baseAdapted.sortingKey) {
const hasIdColumn = baseAdapted.columns.some((x) => x.columnName == 'id');
return {
...table,
...baseAdapted,
primaryKey: {
columns: [
{
@@ -113,11 +114,11 @@ const driver = {
},
]
: []),
...table.columns,
...baseAdapted.columns,
],
};
}
return table;
return baseAdapted;
},
};

View File

@@ -192,13 +192,15 @@ const driver = {
},
adaptTableInfo(table) {
if (!table.primaryKey && !table.sortingKey) {
const baseAdapted = driverBase.adaptTableInfo(table);
if (!baseAdapted.primaryKey && !baseAdapted.sortingKey) {
return {
...table,
...baseAdapted,
tableEngine: 'Log',
};
}
return table;
return baseAdapted;
},
};

View File

@@ -217,6 +217,11 @@ EXECUTE FUNCTION function_name();`,
authTypeLabel: 'Connection mode',
defaultAuthTypeName: 'hostPort',
defaultSocketPath: '/var/run/postgresql',
adaptDataType(dataType) {
if (dataType?.toLowerCase() == 'datetime') return 'timestamp';
return dataType;
},
};
/** @type {import('dbgate-types').EngineDriver} */