| 22 | buildSchemaLines(table).map((column) => normalizeColumnDef(column)); |
| 23 | |
| 24 | const splitSchema = (schema) => { |
| 25 | const parts = []; |
| 26 | let depth = 0; |
| 27 | let current = ""; |
| 28 | for (const char of schema) { |
| 29 | if (char === "(") depth += 1; |
| 30 | if (char === ")" && depth > 0) depth -= 1; |
| 31 | if (char === "," && depth === 0) { |
| 32 | if (current.trim()) parts.push(current.trim()); |
| 33 | current = ""; |
| 34 | continue; |
| 35 | } |
| 36 | current += char; |
| 37 | } |
| 38 | if (current.trim()) parts.push(current.trim()); |
| 39 | return parts; |
| 40 | }; |
| 41 | |
| 42 | async function validateTables(client) { |
| 43 | const issues = []; |