summary refs log tree commit diff
path: root/util
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-17 01:23:51 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-17 01:23:51 +0200
commita8ba406222bbc8c862cab1b4e14b3be398d43371 (patch)
tree0510610e295a30ac3ebf1b50f70c9707fb8b741d /util
parentMerge pull request #467 from hbjydev/fix-migration-column-issue (diff)
downloadserver-a8ba406222bbc8c862cab1b4e14b3be398d43371.tar.xz
:sparkles: migration for timestamp migrations
Diffstat (limited to 'util')
-rw-r--r--util/src/migrations/1634426540271-MigrationTimestamp.ts15
-rw-r--r--util/src/util/Database.ts2
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(),
 					}))
 				);
 			}