fix foreign key generation
This commit is contained in:
parent
db2164f498
commit
56eafe3de2
|
@ -179,7 +179,7 @@ for (const type of Object.keys(schema)) {
|
||||||
const localKey = `${prop.toLowerCase()}_${foreignKey}`;
|
const localKey = `${prop.toLowerCase()}_${foreignKey}`;
|
||||||
|
|
||||||
sqlData += `, ${localKey} INTEGER`;
|
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};`;
|
cData += `\n\t\t${types[propType].c} ${prop};`;
|
||||||
break;
|
break;
|
||||||
case "array":
|
case "array":
|
||||||
|
@ -205,7 +205,7 @@ for (const type of Object.keys(schema)) {
|
||||||
jsData += jsStructConstructor(size, containsString);
|
jsData += jsStructConstructor(size, containsString);
|
||||||
jsData += `\n}\n\nexport default ${type}`;
|
jsData += `\n}\n\nexport default ${type}`;
|
||||||
cData += `\n} ${type};\n\n`;
|
cData += `\n} ${type};\n\n`;
|
||||||
sqlData += `)${foreignKeys};\n\n`;
|
sqlData += `${foreignKeys});\n\n`;
|
||||||
|
|
||||||
await Bun.write(
|
await Bun.write(
|
||||||
Bun.file(values.javascript_out + type + ".js"),
|
Bun.file(values.javascript_out + type + ".js"),
|
||||||
|
|
Loading…
Reference in New Issue