Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main() {
const definitions = await sqlts.toObject(config);
const typeStrings = [];
for (const table of definitions.tables) {
typeStrings.push(createTypeString(table));
}
const tableStrings = [];
for (const table of definitions.tables) {
tableStrings.push(createRuntimeObject(table));
}
let content = `// Auto-generated using \`npm run generate-types\`\n${typeStrings.join('\n\n')}`;
content += '\n\n';
content += `export const databaseSchema:DatabaseTables = {\n${tableStrings.join('\n')}\n};`;
insertContentIntoFile(dbFilePath, config.fileReplaceWithinMarker, config.fileReplaceWithinMarker, content);