diff --git a/src/util/generators/mysql.ts b/src/util/generators/mysql.ts index 2c40844..ad529fc 100755 --- a/src/util/generators/mysql.ts +++ b/src/util/generators/mysql.ts @@ -232,7 +232,7 @@ export const generateMySqlSchema = (options: GeneratorOptions) => { relationArgs.add(field.relationFromFields?.length ? 'one' : 'many'); const relName = s(field.relationName ?? ''); - return `\t'${relName}': ${ + return `\t${field.name}: ${ field.relationFromFields?.length ? `one(${field.type}, {\n\t\trelationName: '${relName}',\n\t\tfields: [${ field.relationFromFields.map((e) => `${schemaTable.name}.${e}`).join(', ') diff --git a/src/util/generators/pg.ts b/src/util/generators/pg.ts index 645fea4..68e9352 100755 --- a/src/util/generators/pg.ts +++ b/src/util/generators/pg.ts @@ -252,7 +252,7 @@ export const generatePgSchema = (options: GeneratorOptions) => { relationArgs.add(field.relationFromFields?.length ? 'one' : 'many'); const relName = s(field.relationName ?? ''); - return `\t'${relName}': ${ + return `\t${field.name}: ${ field.relationFromFields?.length ? `one(${field.type}, {\n\t\trelationName: '${relName}',\n\t\tfields: [${ field.relationFromFields.map((e) => `${schemaTable.name}.${e}`).join(', ') diff --git a/src/util/generators/sqlite.ts b/src/util/generators/sqlite.ts index a924218..57a7739 100755 --- a/src/util/generators/sqlite.ts +++ b/src/util/generators/sqlite.ts @@ -222,7 +222,7 @@ export const generateSQLiteSchema = (options: GeneratorOptions) => { relationArgs.add(field.relationFromFields?.length ? 'one' : 'many'); const relName = s(field.relationName ?? ''); - return `\t'${relName}': ${ + return `\t${field.name}: ${ field.relationFromFields?.length ? `one(${field.type}, {\n\t\trelationName: '${relName}',\n\t\tfields: [${ field.relationFromFields.map((e) => `${schemaTable.name}.${e}`).join(', ')