From 0c078f52667d20fda6f0cfe46632fb0fe21d1549 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sat, 11 Apr 2020 00:23:48 +0200 Subject: [PATCH] Fix types for foreign keys Signed-off-by: David Mehren --- lib/models/author.ts | 4 ++-- lib/models/revision.ts | 2 +- lib/models/user.ts | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/models/author.ts b/lib/models/author.ts index e6bd78f2a..e58e72411 100644 --- a/lib/models/author.ts +++ b/lib/models/author.ts @@ -16,7 +16,7 @@ export class Author extends Model { @ForeignKey(() => Note) @NoteUserIndex - @Column + @Column(DataType.UUID) noteId: string; @BelongsTo(() => Note, { foreignKey: 'noteId', onDelete: 'CASCADE', constraints: false, hooks: true }) @@ -24,7 +24,7 @@ export class Author extends Model { @ForeignKey(() => User) @NoteUserIndex - @Column + @Column(DataType.UUID) userId: string; @BelongsTo(() => User, { foreignKey: 'userId', onDelete: 'CASCADE', constraints: false, hooks: true }) diff --git a/lib/models/revision.ts b/lib/models/revision.ts index dc208d839..f4462e60c 100644 --- a/lib/models/revision.ts +++ b/lib/models/revision.ts @@ -94,7 +94,7 @@ export class Revision extends Model { } @ForeignKey(() => Note) - @Column + @Column(DataType.UUID) noteId: string @BelongsTo(() => Note, { foreignKey: 'noteId', constraints: false, onDelete: 'CASCADE', hooks: true }) diff --git a/lib/models/user.ts b/lib/models/user.ts index 8bb9c91ce..dc691e495 100644 --- a/lib/models/user.ts +++ b/lib/models/user.ts @@ -31,8 +31,7 @@ export class User extends Model { @Column(DataType.TEXT) refreshToken: string; - @IsUUID(4) - @Column + @Column(DataType.UUID) deleteToken: string; @IsEmail