diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 01:23:51 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 01:23:51 +0200 |
commit | 860e86ad19991e29332da316673087125c9c0986 (patch) | |
tree | c7320562885a760bd8a9ef014b1e92c55b37f78e | |
parent | Merge pull request #467 from hbjydev/fix-migration-column-issue (diff) | |
download | server-860e86ad19991e29332da316673087125c9c0986.tar.xz |
:sparkles: migration for timestamp migrations
-rw-r--r-- | util/src/migrations/1634426540271-MigrationTimestamp.ts | 15 | ||||
-rw-r--r-- | util/src/util/Database.ts | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/util/src/migrations/1634426540271-MigrationTimestamp.ts b/util/src/migrations/1634426540271-MigrationTimestamp.ts new file mode 100644 index 00000000..3208b25b --- /dev/null +++ b/util/src/migrations/1634426540271-MigrationTimestamp.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; + +export class MigrationTimestamp1634426540271 implements MigrationInterface { + name = "MigrationTimestamp1634426540271"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.changeColumn( + "migrations", + "timestamp", + new TableColumn({ name: "timestampe", type: "bigint", isNullable: false }) + ); + } + + public async down(queryRunner: QueryRunner): Promise<void> {} +} diff --git a/util/src/util/Database.ts b/util/src/util/Database.ts index c71ebbd4..6124ffab 100644 --- a/util/src/util/Database.ts +++ b/util/src/util/Database.ts @@ -49,7 +49,7 @@ export function initDatabase(): Promise<Connection> { connection.migrations.map((x) => ({ id: i++, name: x.name, - timestamp: Math.floor(Date.now() / 1000), + timestamp: Date.now(), })) ); } |