|
| 1 | +import {MigrationInterface, QueryRunner} from "typeorm"; |
| 2 | + |
| 3 | +export class AddBaseEntity1589291828794 implements MigrationInterface { |
| 4 | + name = 'AddBaseEntity1589291828794' |
| 5 | + |
| 6 | + public async up(queryRunner: QueryRunner): Promise<void> { |
| 7 | + await queryRunner.query(`ALTER TABLE "episode" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 8 | + await queryRunner.query(`ALTER TABLE "episode" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 9 | + await queryRunner.query(`ALTER TABLE "category" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 10 | + await queryRunner.query(`ALTER TABLE "category" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 11 | + await queryRunner.query(`ALTER TABLE "author" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 12 | + await queryRunner.query(`ALTER TABLE "author" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 13 | + await queryRunner.query(`ALTER TABLE "queue" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 14 | + await queryRunner.query(`ALTER TABLE "queue" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()`, undefined); |
| 15 | + } |
| 16 | + |
| 17 | + public async down(queryRunner: QueryRunner): Promise<void> { |
| 18 | + await queryRunner.query(`ALTER TABLE "queue" DROP COLUMN "updatedAt"`, undefined); |
| 19 | + await queryRunner.query(`ALTER TABLE "queue" DROP COLUMN "createdAt"`, undefined); |
| 20 | + await queryRunner.query(`ALTER TABLE "author" DROP COLUMN "updatedAt"`, undefined); |
| 21 | + await queryRunner.query(`ALTER TABLE "author" DROP COLUMN "createdAt"`, undefined); |
| 22 | + await queryRunner.query(`ALTER TABLE "category" DROP COLUMN "updatedAt"`, undefined); |
| 23 | + await queryRunner.query(`ALTER TABLE "category" DROP COLUMN "createdAt"`, undefined); |
| 24 | + await queryRunner.query(`ALTER TABLE "episode" DROP COLUMN "updatedAt"`, undefined); |
| 25 | + await queryRunner.query(`ALTER TABLE "episode" DROP COLUMN "createdAt"`, undefined); |
| 26 | + } |
| 27 | + |
| 28 | +} |
0 commit comments