Skip to content

Commit

Permalink
Prevent typeorm from attempting to update nullable columns on every sync
Browse files Browse the repository at this point in the history
This is a bug in typeorm, see:
typeorm/typeorm#3076 (comment)
  • Loading branch information
emlun committed Aug 17, 2023
1 parent edf34c6 commit c0d8775
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/entities/LegalPerson.entity.ts
Expand Up @@ -20,10 +20,12 @@ class LegalPersonEntity {
did: string = "";


@Column({ nullable: true })
// Explicit default to workaround a bug in typeorm: https://github.com/typeorm/typeorm/issues/3076#issuecomment-703128687
@Column({ nullable: true, default: () => "NULL" })
client_id: string = "";

@Column({ nullable: true })

// Explicit default to workaround a bug in typeorm: https://github.com/typeorm/typeorm/issues/3076#issuecomment-703128687
@Column({ nullable: true, default: () => "NULL" })
client_secret: string = "";
}

Expand Down Expand Up @@ -196,4 +198,4 @@ export {
getLegalPersonByDID,
getAllLegalPersonsDIDs,
getLegalPersonByUrl
}
}
10 changes: 6 additions & 4 deletions src/entities/user.entity.ts
Expand Up @@ -26,11 +26,13 @@ class UserEntity {
keys: Buffer = Buffer.from("");


@Column( {type: "blob", nullable: true })
fcmToken: Buffer = Buffer.from("");
// Explicit default to workaround a bug in typeorm: https://github.com/typeorm/typeorm/issues/3076#issuecomment-703128687
@Column({ type: "blob", nullable: true, default: () => "NULL" })
fcmToken: Buffer;

@Column( { type: "blob", nullable: true })
browserFcmToken: Buffer = Buffer.from("");
// Explicit default to workaround a bug in typeorm: https://github.com/typeorm/typeorm/issues/3076#issuecomment-703128687
@Column( { type: "blob", nullable: true, default: () => "NULL" })
browserFcmToken: Buffer;

@Column({ type: "bool", default: false })
isAdmin: boolean = false;
Expand Down

0 comments on commit c0d8775

Please sign in to comment.