fix(performance): Import deps dynamically (#652)

This commit is contained in:
Guy Ben-Aharon
2025-04-07 17:08:02 +03:00
committed by GitHub
parent fc46cbb893
commit e3cb62788c
13 changed files with 51 additions and 51 deletions

View File

@@ -19,7 +19,6 @@ import type {
AlterTableStatement,
} from './postgresql-common';
import {
parser,
parserOpts,
extractColumnName,
getTypeArgs,
@@ -28,12 +27,16 @@ import {
} from './postgresql-common';
// PostgreSQL-specific parsing logic
export function fromPostgres(sqlContent: string): SQLParserResult {
export async function fromPostgres(
sqlContent: string
): Promise<SQLParserResult> {
const tables: SQLTable[] = [];
const relationships: SQLForeignKey[] = [];
const tableMap: Record<string, string> = {}; // Maps table name to its ID
try {
const { Parser } = await import('node-sql-parser');
const parser = new Parser();
// Parse the SQL DDL statements
const ast = parser.astify(sqlContent, parserOpts);