Skip to content

Commit f8bbfca

Browse files
committed
chore: re-use generateColumn
1 parent 8429509 commit f8bbfca

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/server/templates/typescript.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,22 @@ export const apply = async ({
271271
if (relation) {
272272
return `{
273273
${columnsByTableId[relation.id]
274-
.map(
275-
(column) =>
276-
`${JSON.stringify(column.name)}: ${pgTypeToTsType(schema, column.format, {
274+
.map((column) =>
275+
generateColumnTsDefinition(
276+
schema,
277+
{
278+
name: column.name,
279+
format: column.format,
280+
is_nullable: column.is_nullable,
281+
is_optional: false,
282+
},
283+
{
277284
types,
278285
schemas,
279286
tables,
280287
views,
281-
})} ${column.is_nullable ? '| null' : ''}`
288+
}
289+
)
282290
)
283291
.join(',\n')}
284292
}`

0 commit comments

Comments
 (0)