MCPcopy
hub / github.com/chartdb/chartdb / fixMultilineTableNames

Function fixMultilineTableNames

src/lib/dbml/dbml-export/dbml-export.ts:704–718  ·  view source on GitHub ↗
(dbml: string)

Source from the content-addressed store, hash-verified

702
703// Fix table names that have been broken across multiple lines
704const fixMultilineTableNames = (dbml: string): string => {
705 // Match Table declarations that might have line breaks in the table name
706 // This regex captures:
707 // - Table keyword
708 // - Optional quoted schema with dot
709 // - Table name that might be broken across lines (until the opening brace)
710 return dbml.replace(
711 /Table\s+((?:"[^"]*"\.)?"[^"]*(?:\n[^"]*)*")\s*\{/g,
712 (_, tableName) => {
713 // Remove line breaks within the table name
714 const fixedTableName = tableName.replace(/\n\s*/g, '');
715 return `Table ${fixedTableName} {`;
716 }
717 );
718};
719
720// Restore increment attribute for auto-incrementing fields
721const restoreIncrementAttribute = (dbml: string, tables: DBTable[]): string => {

Callers 1

generateDBMLFromDiagramFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected