From 246d053b680ef023c591096bc102fc6d1ef01d0f Mon Sep 17 00:00:00 2001 From: David Mehren Date: Thu, 29 Apr 2021 19:08:59 +0200 Subject: [PATCH] Add explicit type annotations to nullable columns TypeORM can't correctly infer the data type on properties with a `| null` type. This commit adds explicit type annotations. See also https://github.com/typeorm/typeorm/issues/2567#issuecomment-408599335 Signed-off-by: David Mehren --- src/auth/auth-token.entity.ts | 2 ++ src/media/media-upload.entity.ts | 1 + src/notes/note.entity.ts | 3 +++ src/users/identity.entity.ts | 3 +++ src/users/user.entity.ts | 2 ++ 5 files changed, 11 insertions(+) diff --git a/src/auth/auth-token.entity.ts b/src/auth/auth-token.entity.ts index 6a3349899..d65beba5a 100644 --- a/src/auth/auth-token.entity.ts +++ b/src/auth/auth-token.entity.ts @@ -37,11 +37,13 @@ export class AuthToken { @Column({ nullable: true, + type: 'date', }) validUntil: Date | null; @Column({ nullable: true, + type: 'date', }) lastUsed: Date | null; diff --git a/src/media/media-upload.entity.ts b/src/media/media-upload.entity.ts index ffa04146a..64918074b 100644 --- a/src/media/media-upload.entity.ts +++ b/src/media/media-upload.entity.ts @@ -43,6 +43,7 @@ export class MediaUpload { @Column({ nullable: true, + type: 'text', }) backendData: BackendData | null; diff --git a/src/notes/note.entity.ts b/src/notes/note.entity.ts index 3f7da51c1..db53f546e 100644 --- a/src/notes/note.entity.ts +++ b/src/notes/note.entity.ts @@ -35,6 +35,7 @@ export class Note { @Column({ unique: true, nullable: true, + type: 'text', }) alias: string | null; @OneToMany( @@ -70,10 +71,12 @@ export class Note { @Column({ nullable: true, + type: 'text', }) description: string | null; @Column({ nullable: true, + type: 'text', }) title: string | null; diff --git a/src/users/identity.entity.ts b/src/users/identity.entity.ts index 6f78714b2..8cbe0f230 100644 --- a/src/users/identity.entity.ts +++ b/src/users/identity.entity.ts @@ -38,16 +38,19 @@ export class Identity { @Column({ nullable: true, + type: 'text', }) providerUserId: string | null; @Column({ nullable: true, + type: 'text', }) oAuthAccessToken: string | null; @Column({ nullable: true, + type: 'text', }) passwordHash: string | null; } diff --git a/src/users/user.entity.ts b/src/users/user.entity.ts index 606068dc7..b3267db57 100644 --- a/src/users/user.entity.ts +++ b/src/users/user.entity.ts @@ -40,11 +40,13 @@ export class User { @Column({ nullable: true, + type: 'text', }) photo: string | null; @Column({ nullable: true, + type: 'text', }) email: string | null;