This commit is contained in:
NoriDev 2024-01-02 19:40:53 +09:00
parent 4b6e2f6d7f
commit bdf96da9da

View file

@ -2,8 +2,16 @@ export class NoteUpdatedAt1704185628000 {
name = 'NoteUpdatedAt1704185628000'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "updatedAt"`);
await queryRunner.query(`ALTER TABLE "note" ADD "updatedAt" TIMESTAMP WITH TIME ZONE`);
await queryRunner.query(`SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'note' AND column_name = 'updatedAt'`)
.then(updatedAt => {
if (updatedAt.length > 0) {
return [];
} else {
return [
queryRunner.query(`ALTER TABLE "note" ADD "updatedAt" TIMESTAMP WITH TIME ZONE`)
];
}
})
}
async down(queryRunner) {