Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { Compiler } from '@dbml/parse';

/**
* Renames a table in DBML code using symbol table and token-based replacement.
*
* @param {string | { schema?: string; table: string }} oldName - The current table name
* @param {string | { schema?: string; table: string }} newName - The new table name
* @param {string} dbmlCode - The DBML code containing the table
* @returns {string} The updated DBML code with the renamed table
*
* @example
* // String format
* renameTable('users', 'customers', dbmlCode);
Expand All @@ -18,7 +12,11 @@ import { Compiler } from '@dbml/parse';
* renameTable({ table: 'users' }, { table: 'customers' }, dbmlCode);
* renameTable({ schema: 'auth', table: 'users' }, { schema: 'auth', table: 'customers' }, dbmlCode);
*/
export function renameTable (oldName, newName, dbmlCode) {
export function renameTable (
oldName:string | { schema?: string; table: string },
newName: string | { schema?: string; table: string },
dbmlCode: string,
): string {
const compiler = new Compiler();
compiler.setSource(dbmlCode);
return compiler.renameTable(oldName, newName);
Expand Down
4 changes: 0 additions & 4 deletions packages/dbml-core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import ModelExporter from './export/ModelExporter';
import Parser from './parse/Parser';
import importer from './import';
import exporter from './export';
import {
renameTable,
} from './transform';
export {
renameTable,
importer,
exporter,
ModelExporter,
Expand Down
7 changes: 0 additions & 7 deletions packages/dbml-core/types/transform/index.d.ts

This file was deleted.

Loading