diff --git a/TODO.md b/TODO.md index d2877e15..ea880bb3 100644 --- a/TODO.md +++ b/TODO.md @@ -16,6 +16,7 @@ - [ ] ZModel - [x] Import - [ ] View support + - [ ] Datasource provider-scoped attributes - [ ] ORM - [x] Create - [x] Input validation diff --git a/packages/runtime/src/client/helpers/schema-db-pusher.ts b/packages/runtime/src/client/helpers/schema-db-pusher.ts index 4978dedf..bbfa2a3e 100644 --- a/packages/runtime/src/client/helpers/schema-db-pusher.ts +++ b/packages/runtime/src/client/helpers/schema-db-pusher.ts @@ -188,6 +188,10 @@ export class SchemaDbPusher { return 'serial'; } + if (this.isCustomType(fieldDef.type)) { + return 'jsonb'; + } + const type = fieldDef.type as BuiltinType; const result = match(type) .with('String', () => 'text') @@ -211,6 +215,10 @@ export class SchemaDbPusher { } } + private isCustomType(type: string) { + return this.schema.typeDefs && Object.values(this.schema.typeDefs).some((def) => def.name === type); + } + private isAutoIncrement(fieldDef: FieldDef) { return ( fieldDef.default &&