Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

fix build

Guy Ben-Aharonee4f3e881949
diff --git a/src/lib/data/export-metadata/export-sql-script.ts b/src/lib/data/export-metadata/export-sql-script.ts
index f949b7b7..a02622af 100644
--- a/src/lib/data/export-metadata/export-sql-script.ts
+++ b/src/lib/data/export-metadata/export-sql-script.ts
@@ -203,16 +203,15 @@ const generateSQLPrompt = (databaseType: DatabaseType, sqlScript: string) => {
- **Column Name Conflicts**: When a column name conflicts with a data type or reserved keyword (e.g., fulltext), escape the column name by enclosing it.
`;
- const dialectInstructionMap: Record<DatabaseType, string> =
- {
- generic:'',
- postgresql: `
+ const dialectInstructionMap: Record<DatabaseType, string> = {
+ generic: '',
+ postgresql: `
- **Sequence Creation**: Use \`CREATE SEQUENCE IF NOT EXISTS\` for sequence creation.
- **Table and Index Creation**: Use \`CREATE TABLE IF NOT EXISTS\` and \`CREATE INDEX IF NOT EXISTS\` to avoid errors if the object already exists.
- **Serial and Identity Columns**: For auto-increment columns, use \`SERIAL\` or \`GENERATED BY DEFAULT AS IDENTITY\`.
- **Conditional Statements**: Utilize PostgreSQL’s support for \`IF NOT EXISTS\` in relevant \`CREATE\` statements.
`,
-  mysql: `
+ mysql: `
- **Table Creation**: Use \`CREATE TABLE IF NOT EXISTS\` for creating tables. While creating the table structure, ensure that all foreign key columns use the correct data types as determined in the foreign key review.
- **Auto-Increment**: Use \`AUTO_INCREMENT\` for auto-incrementing primary key columns.
- **Index Creation**: Place all \`CREATE INDEX\` statements separately after the \`CREATE TABLE\` statement. Avoid using \`IF NOT EXISTS\` in \`CREATE INDEX\` statements.
@@ -227,13 +226,13 @@ const generateSQLPrompt = (databaseType: DatabaseType, sqlScript: string) => {
**Reminder**: Ensure all column names that conflict with reserved keywords or data types (like \`fulltext\`) are escaped using backticks (\`).
`,
- sql_server: `
+ sql_server: `
- **Sequence Creation**: Use \`CREATE SEQUENCE\` without \`IF NOT EXISTS\`, and employ conditional logic (\`IF NOT EXISTS\`) to check for sequence existence before creation.
- **Identity Columns**: Always prefer using the \`IDENTITY\` keyword (e.g., \`INT IDENTITY(1,1)\`) for auto-incrementing primary key columns when possible.
- **Conditional Logic**: Use a conditional block like \`IF NOT EXISTS (SELECT * FROM sys.objects WHERE ...)\` since SQL Server doesn’t support \`IF NOT EXISTS\` directly in \`CREATE\` statements.
- **Avoid Unsupported Syntax**: Ensure the script does not include unsupported statements like \`CREATE TABLE IF NOT EXISTS\`.
`,
- mariadb: `
+ mariadb: `
- **Table Creation**: Use \`CREATE TABLE IF NOT EXISTS\` for creating tables. While creating the table structure, ensure that all foreign key columns use the correct data types as determined in the foreign key review.
- **Auto-Increment**: Use \`AUTO_INCREMENT\` for auto-incrementing primary key columns.
- **Index Creation**: Place all \`CREATE INDEX\` statements separately after the \`CREATE TABLE\` statement. Avoid using \`IF NOT EXISTS\` in \`CREATE INDEX\` statements.
@@ -248,7 +247,7 @@ const generateSQLPrompt = (databaseType: DatabaseType, sqlScript: string) => {
**Reminder**: Ensure all column names that conflict with reserved keywords or data types (like \`fulltext\`) are escaped using backticks (\`).
`,
- sqlite: `
+ sqlite: `
- **Table Creation**: Use \`CREATE TABLE IF NOT EXISTS\`.
- **Auto-Increment**: Use \`AUTOINCREMENT\` with \`INTEGER PRIMARY KEY\` for auto-increment functionality.
- **No Sequence Support**: SQLite does not support sequences; rely solely on \`AUTOINCREMENT\` for similar functionality.
@@ -257,9 +256,9 @@ const generateSQLPrompt = (databaseType: DatabaseType, sqlScript: string) => {
- **General SQLite Constraints**: Remember, \`ALTER TABLE\` in SQLite is limited and cannot add constraints after the table is created.
- **Conditional Logic**: Ensure the script uses SQLite-compatible syntax and does not include unsupported features.
`,
- };
+ };
- const dialectInstruction:string = dialectInstructionMap[databaseType] ?? '';
+ const dialectInstruction = dialectInstructionMap[databaseType] ?? '';
const additionalInstructions = `
**Provide just the SQL commands without markdown tags.**