Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [ ] ZModel
- [x] Import
- [ ] View support
- [ ] Datasource provider-scoped attributes
- [ ] ORM
- [x] Create
- [x] Input validation
Expand Down
8 changes: 8 additions & 0 deletions packages/runtime/src/client/helpers/schema-db-pusher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export class SchemaDbPusher<Schema extends SchemaDef> {
return 'serial';
}

if (this.isCustomType(fieldDef.type)) {
return 'jsonb';
}

const type = fieldDef.type as BuiltinType;
const result = match<BuiltinType, ColumnDataType>(type)
.with('String', () => 'text')
Expand All @@ -211,6 +215,10 @@ export class SchemaDbPusher<Schema extends SchemaDef> {
}
}

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 &&
Expand Down