Skip to content

Commit

Permalink
fix 6df51bf
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Jan 2, 2024
1 parent 4b6e2f6 commit bdf96da
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/backend/migration/1704185628000-note-updated-at2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bdf96da

Please sign in to comment.