fix foreign key generation

This commit is contained in:
zongor 2024-05-27 20:29:39 -04:00
parent db2164f498
commit 56eafe3de2
1 changed files with 3 additions and 3 deletions

View File

@ -179,7 +179,7 @@ for (const type of Object.keys(schema)) {
const localKey = `${prop.toLowerCase()}_${foreignKey}`;
sqlData += `, ${localKey} INTEGER`;
foreignKeys += `\nFOREIGN KEY(${localKey}) REFERENCES ${propType}(${foreignKey})`
foreignKeys += `\n, FOREIGN KEY(${localKey}) REFERENCES ${propType}(${foreignKey})`
cData += `\n\t\t${types[propType].c} ${prop};`;
break;
case "array":
@ -205,7 +205,7 @@ for (const type of Object.keys(schema)) {
jsData += jsStructConstructor(size, containsString);
jsData += `\n}\n\nexport default ${type}`;
cData += `\n} ${type};\n\n`;
sqlData += `)${foreignKeys};\n\n`;
sqlData += `${foreignKeys});\n\n`;
await Bun.write(
Bun.file(values.javascript_out + type + ".js"),