rawsql-ts
Version:
High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
25 lines (24 loc) • 1.13 kB
TypeScript
export declare class DDLToFixtureConverter {
/**
* Converts DDL statements (CREATE TABLE) in the provided SQL text to a Fixture JSON object.
* Ignores non-DDL statements and parse errors.
*
* @param ddlSql The SQL text containing CREATE TABLE statements.
* @returns A Record representing the Fixture JSON.
*/
static convert(ddlSql: string): Record<string, any>;
/**
* Applies `ALTER TABLE ... ALTER COLUMN ... SET/DROP DEFAULT` actions to the table registry.
*
* Uses normalization-based resolution to map `ALTER TABLE` targets to matching `CREATE TABLE` entries.
* Ambiguous or unresolved table names are skipped to avoid accidental cross-table updates.
*
* Only `AlterTableAlterColumnDefault` actions are processed; all other ALTER TABLE actions are ignored.
*
* @param registry The table definition registry built from `CREATE TABLE` statements.
* @param alterStatements The `ALTER TABLE` statements to apply.
*/
private static applyAlterTableStatements;
private static extractValue;
private static formatDefaultValue;
}