@happyvertical/sql 0.88.0 → 0.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2827,9 +2827,11 @@ async function createDatabase(config) {
|
|
|
2827
2827
|
if (!await tableExists(tableName)) await executor.query(trimmedCommand);
|
|
2828
2828
|
else for (const column of columns) {
|
|
2829
2829
|
const columnDef = column.trim();
|
|
2830
|
-
|
|
2830
|
+
if (/^(?:CONSTRAINT\s+(?:"(?:[^"]|"")*"|\w+)\s+)?(?:(?:PRIMARY\s+KEY|FOREIGN\s+KEY|UNIQUE|CHECK)\b|EXCLUDE(?=\s+(?:USING\b|\()))/i.test(columnDef)) continue;
|
|
2831
|
+
const columnMatch = columnDef.match(/^("(?:[^"]|"")*"|\w+)\s+\w+[^,]*/);
|
|
2831
2832
|
if (columnMatch) {
|
|
2832
|
-
const
|
|
2833
|
+
const identifier = columnMatch[1];
|
|
2834
|
+
const columnName = identifier.startsWith("\"") ? identifier.slice(1, -1).replace(/""/g, "\"") : identifier;
|
|
2833
2835
|
if (columnName.toUpperCase() === "PRIMARY" || columnName.toUpperCase() === "FOREIGN" || columnName.toUpperCase() === "UNIQUE" || columnName.toUpperCase() === "CHECK" || columnName.toUpperCase() === "CONSTRAINT") continue;
|
|
2834
2836
|
try {
|
|
2835
2837
|
await runTolerated(async () => {
|