remove duplicate generated columns from LatestNote

This commit is contained in:
Hazel K 2024-09-29 22:51:24 -04:00
parent 0a09e6d86a
commit 01ec9635c1
2 changed files with 9 additions and 5 deletions

View File

@ -2,9 +2,9 @@ export class AddLatestNote1727659258948 {
name = 'AddLatestNote1727659258948';
async up(queryRunner) {
await queryRunner.query('CREATE TABLE "latest_note" ("user_id" character varying(32) NOT NULL, "note_id" character varying(32) NOT NULL, "userId" character varying(32), "noteId" character varying(32), CONSTRAINT "PK_f619b62bfaafabe68f52fb50c9a" PRIMARY KEY ("user_id"))');
await queryRunner.query('ALTER TABLE "latest_note" ADD CONSTRAINT "FK_20e346fffe4a2174585005d6d80" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION');
await queryRunner.query('ALTER TABLE "latest_note" ADD CONSTRAINT "FK_47a38b1c13de6ce4e5090fb1acd" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION');
await queryRunner.query('CREATE TABLE "latest_note" ("user_id" character varying(32) NOT NULL, "note_id" character varying(32) NOT NULL, CONSTRAINT "PK_f619b62bfaafabe68f52fb50c9a" PRIMARY KEY ("user_id"))');
await queryRunner.query('ALTER TABLE "latest_note" ADD CONSTRAINT "FK_20e346fffe4a2174585005d6d80" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION');
await queryRunner.query('ALTER TABLE "latest_note" ADD CONSTRAINT "FK_47a38b1c13de6ce4e5090fb1acd" FOREIGN KEY ("note_id") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION');
}
async down(queryRunner) {

View File

@ -19,7 +19,9 @@ export class LatestNote {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@JoinColumn({
name: 'user_id',
})
public user: MiUser | null;
@Column({
@ -32,7 +34,9 @@ export class LatestNote {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
@JoinColumn({
name: 'note_id',
})
public note: MiNote | null;
constructor(data: Partial<LatestNote>) {