fixed import for clickhouse

This commit is contained in:
Jan Prochazka
2024-09-13 15:47:12 +02:00
parent 89c9d5e792
commit 334440f691
6 changed files with 20 additions and 7 deletions

View File

@@ -37,7 +37,8 @@ export function createBulkInsertStreamBase(driver: EngineDriver, stream, pool, n
}
if (options.createIfNotExists && (!structure || options.dropIfExists)) {
const dmp = driver.createDumper();
dmp.createTable(prepareTableForImport({ ...writable.structure, ...name }));
const createdTableInfo = driver.adaptTableInfo(prepareTableForImport({ ...writable.structure, ...name }));
dmp.createTable(createdTableInfo);
logger.info({ sql: dmp.s }, `Creating table ${fullNameQuoted}`);
await driver.script(pool, dmp.s);
structure = await driver.analyseSingleTable(pool, name);

View File

@@ -177,4 +177,8 @@ export const driverBase = {
createSaveChangeSetScript(changeSet, dbinfo, defaultCreator) {
return defaultCreator(changeSet, dbinfo);
},
adaptTableInfo(table) {
return table;
}
};

View File

@@ -228,6 +228,8 @@ export interface EngineDriver extends FilterBehaviourProvider {
dbinfo: DatabaseInfo,
defaultCreator: (changeSet: any, dbinfo: DatabaseInfo) => any
): any[];
// adapts table info from different source (import, other database) to be suitable for this database
adaptTableInfo(table: TableInfo): TableInfo;
analyserClass?: any;
dumperClass?: any;