add type columns to SkLatestNote
This commit is contained in:
parent
fea993f6b2
commit
9d3292e6e9
2 changed files with 42 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class TrackLatestNoteType1728420772835 {
|
||||||
|
name = 'TrackLatestNoteType1728420772835'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" DROP CONSTRAINT "PK_f619b62bfaafabe68f52fb50c9a"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" ADD "isPublic" boolean NOT NULL DEFAULT false`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" ADD "isReply" boolean NOT NULL DEFAULT false`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" ADD "isQuote" boolean NOT NULL DEFAULT false`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" ADD CONSTRAINT "PK_a44ac8ca9cb916faeefc0912abd" PRIMARY KEY ("user_id", "isPublic", "isReply", "isQuote")`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" DROP CONSTRAINT "PK_a44ac8ca9cb916faeefc0912abd"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" DROP COLUMN "isQuote"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" DROP COLUMN "isReply"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" DROP COLUMN "isPublic"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "latest_note" ADD CONSTRAINT "PK_f619b62bfaafabe68f52fb50c9a" PRIMARY KEY ("user_id")`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,24 @@ export class SkLatestNote {
|
||||||
})
|
})
|
||||||
public userId: string;
|
public userId: string;
|
||||||
|
|
||||||
|
@PrimaryColumn('boolean', {
|
||||||
|
name: 'is_public',
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public isPublic: boolean;
|
||||||
|
|
||||||
|
@PrimaryColumn('boolean', {
|
||||||
|
name: 'is_reply',
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public isReply: boolean;
|
||||||
|
|
||||||
|
@PrimaryColumn('boolean', {
|
||||||
|
name: 'is_quote',
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public isQuote: boolean;
|
||||||
|
|
||||||
@ManyToOne(() => MiUser, {
|
@ManyToOne(() => MiUser, {
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue