Skip to content

Commit

Permalink
fix(sql): resolve Date|null to date type
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Mar 24, 2024
1 parent d34b1a3 commit ab12802
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/postgres/src/postgres-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import {
Table,
typeResolvesToBigInt,
typeResolvesToBoolean,
typeResolvesToDate,
typeResolvesToInteger,
typeResolvesToNumber,
typeResolvesToString,
} from '@deepkit/sql';
import { postgresSerializer } from './postgres-serializer.js';
import {
isDateType,
isReferenceType,
isUUIDType,
ReflectionClass,
Expand Down Expand Up @@ -109,7 +109,7 @@ export class PostgresPlatform extends DefaultPlatform {

this.addType(isUUIDType, 'uuid');
this.addBinaryType('bytea');
this.addType(isDateType, 'timestamp');
this.addType(typeResolvesToDate, 'timestamp');
}

override getSqlTypeCaster(type: Type): (placeholder: string) => string {
Expand Down
3 changes: 2 additions & 1 deletion packages/sqlite/src/sqlite-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Table,
TableDiff,
typeResolvesToBoolean,
typeResolvesToDate,
typeResolvesToInteger,
typeResolvesToNumber,
typeResolvesToString,
Expand Down Expand Up @@ -62,7 +63,7 @@ export class SQLitePlatform extends DefaultPlatform {
this.addType(() => true, 'text');

this.addType(isUUIDType, 'blob');
this.addType(isDateType, 'text');
this.addType(typeResolvesToDate, 'text');

this.addType(typeResolvesToString, 'text');
this.addType(typeResolvesToInteger, 'integer');
Expand Down

0 comments on commit ab12802

Please sign in to comment.