Skip to content

Commit 82e56ca

Browse files
easyCZroboquat
authored andcommitted
[pat] Apply on-update property to _lastModified column, remove from expirationTime
1 parent 19b72c5 commit 82e56ca

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License-AGPL.txt in the project root for license information.
5+
*/
6+
7+
import { MigrationInterface, QueryRunner } from "typeorm";
8+
9+
const TABLE_NAME = "d_b_personal_access_token";
10+
11+
export class PersonalAccessTokenFixLastModifiedAutoUpdate1669888999897 implements MigrationInterface {
12+
public async up(queryRunner: QueryRunner): Promise<void> {
13+
await queryRunner.query(`ALTER TABLE ${TABLE_NAME} MODIFY expirationTime timestamp(6) NOT NULL`);
14+
await queryRunner.query(
15+
`ALTER TABLE ${TABLE_NAME} MODIFY _lastModified timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP(6)`,
16+
);
17+
}
18+
19+
public async down(queryRunner: QueryRunner): Promise<void> {}
20+
}

0 commit comments

Comments
 (0)