diff --git a/scripts/generate-drizzle-schema.mjs b/scripts/generate-drizzle-schema.mjs index 62fbeacd57..7b078e42f7 100644 --- a/scripts/generate-drizzle-schema.mjs +++ b/scripts/generate-drizzle-schema.mjs @@ -42,13 +42,15 @@ function parseDrizzleTables(source) { const re2 = /^export const (\w+) = mysqlTable\(\s*"([^"]+)"\s*,\s*\{([\s\S]*?)\n\}(?:,\s*\(t\)\s*=>\s*\[([\s\S]*?)\])?\s*\);/gm; - let match; + let match = re2.exec(source); const seen = new Set(); - while ((match = re2.exec(source)) !== null) { + while (match !== null) { const [, name, table, body, extras] = match; - if (seen.has(name)) continue; - seen.add(name); - models.push(parseTableBody(name, table, body, extras ?? "")); + if (!seen.has(name)) { + seen.add(name); + models.push(parseTableBody(name, table, body, extras ?? "")); + } + match = re2.exec(source); } if (models.length === 0) {