Skip to content

Commit 249fc4e

Browse files
committed
refactor: migrate transform
1 parent 902ada6 commit 249fc4e

3 files changed

Lines changed: 5 additions & 18 deletions

File tree

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ import { Compiler } from '@dbml/parse';
22

33
/**
44
* Renames a table in DBML code using symbol table and token-based replacement.
5-
*
6-
* @param {string | { schema?: string; table: string }} oldName - The current table name
7-
* @param {string | { schema?: string; table: string }} newName - The new table name
8-
* @param {string} dbmlCode - The DBML code containing the table
9-
* @returns {string} The updated DBML code with the renamed table
10-
*
115
* @example
126
* // String format
137
* renameTable('users', 'customers', dbmlCode);
@@ -18,7 +12,11 @@ import { Compiler } from '@dbml/parse';
1812
* renameTable({ table: 'users' }, { table: 'customers' }, dbmlCode);
1913
* renameTable({ schema: 'auth', table: 'users' }, { schema: 'auth', table: 'customers' }, dbmlCode);
2014
*/
21-
export function renameTable (oldName, newName, dbmlCode) {
15+
export function renameTable (
16+
oldName:string | { schema?: string; table: string },
17+
newName: string | { schema?: string; table: string },
18+
dbmlCode: string,
19+
): string {
2220
const compiler = new Compiler();
2321
compiler.setSource(dbmlCode);
2422
return compiler.renameTable(oldName, newName);

packages/dbml-core/types/index.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import ModelExporter from './export/ModelExporter';
22
import Parser from './parse/Parser';
33
import importer from './import';
44
import exporter from './export';
5-
import {
6-
renameTable,
7-
} from './transform';
85
export {
9-
renameTable,
106
importer,
117
exporter,
128
ModelExporter,

packages/dbml-core/types/transform/index.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)