Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
export class adServiceCredits1784000000000 {
|
||||
name = "adServiceCredits1784000000000";
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "promo_note" ADD COLUMN IF NOT EXISTS "totalCredits" integer NOT NULL DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE "promo_note" ADD COLUMN IF NOT EXISTS "remainingCredits" integer NOT NULL DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" ADD COLUMN IF NOT EXISTS "readDay" character varying(10)`);
|
||||
await queryRunner.query(`UPDATE "promo_read" SET "readDay" = to_char("createdAt" AT TIME ZONE 'UTC', 'YYYY-MM-DD') WHERE "readDay" IS NULL`);
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" ALTER COLUMN "readDay" SET NOT NULL`);
|
||||
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_2882b8a1a07c7d281a98b6db16"`);
|
||||
await queryRunner.query(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_promo_read_user_note_day" ON "promo_read" ("userId", "noteId", "readDay")`);
|
||||
}
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_promo_read_user_note_day"`);
|
||||
await queryRunner.query(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_2882b8a1a07c7d281a98b6db16" ON "promo_read" ("userId", "noteId")`);
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" DROP COLUMN IF EXISTS "readDay"`);
|
||||
await queryRunner.query(`ALTER TABLE "promo_note" DROP COLUMN IF EXISTS "remainingCredits"`);
|
||||
await queryRunner.query(`ALTER TABLE "promo_note" DROP COLUMN IF EXISTS "totalCredits"`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user