diff --git a/packages/backend/migration/1676438468213-ad3.js b/packages/backend/migration/1676438468213-ad3.js index c55f6ae361..bf1f384adc 100644 --- a/packages/backend/migration/1676438468213-ad3.js +++ b/packages/backend/migration/1676438468213-ad3.js @@ -1,7 +1,7 @@ export class ad1676438468213 { name = 'ad1676438468213'; async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "ad" ADD "startsAt" TIMESTAMP WITH TIME ZONE NOT NULL`); + await queryRunner.query(`ALTER TABLE "ad" ADD "startsAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`); } async down(queryRunner) { await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "startsAt"`); diff --git a/packages/backend/src/models/entities/Ad.ts b/packages/backend/src/models/entities/Ad.ts index 450336a016..56baf863ca 100644 --- a/packages/backend/src/models/entities/Ad.ts +++ b/packages/backend/src/models/entities/Ad.ts @@ -21,6 +21,7 @@ export class Ad { @Index() @Column('timestamp with time zone', { comment: 'The expired date of the Ad.', + default: () => 'now()', }) public startsAt: Date;