mirror of
https://github.com/chartdb/chartdb.git
synced 2025-11-05 06:23:17 +00:00
fix(export-sql): move from AI sql-export for sqlite to deterministic script (#627)
This commit is contained in:
@@ -6,6 +6,7 @@ import type { DataType } from '../data-types/data-types';
|
||||
import { generateCacheKey, getFromCache, setInCache } from './export-sql-cache';
|
||||
import { exportMSSQL } from './export-per-type/mssql';
|
||||
import { exportPostgreSQL } from './export-per-type/postgresql';
|
||||
import { exportSQLite } from './export-per-type/sqlite';
|
||||
|
||||
export const exportBaseSQL = ({
|
||||
diagram,
|
||||
@@ -38,6 +39,14 @@ export const exportBaseSQL = ({
|
||||
return exportPostgreSQL(diagram);
|
||||
}
|
||||
|
||||
if (
|
||||
!isDBMLFlow &&
|
||||
diagram.databaseType === DatabaseType.SQLITE &&
|
||||
targetDatabaseType === DatabaseType.SQLITE
|
||||
) {
|
||||
return exportSQLite(diagram);
|
||||
}
|
||||
|
||||
// Filter out the tables that are views
|
||||
const nonViewTables = tables.filter((table) => !table.isView);
|
||||
|
||||
@@ -288,6 +297,13 @@ export const exportSQL = async (
|
||||
return sqlScript;
|
||||
}
|
||||
|
||||
if (
|
||||
databaseType === DatabaseType.SQLITE &&
|
||||
diagram.databaseType === DatabaseType.SQLITE
|
||||
) {
|
||||
return sqlScript;
|
||||
}
|
||||
|
||||
const cacheKey = await generateCacheKey(databaseType, sqlScript);
|
||||
|
||||
const cachedResult = getFromCache(cacheKey);
|
||||
|
||||
Reference in New Issue
Block a user