mirror of
https://github.com/spacebarchat/server.git
synced 2026-04-04 13:05:42 +00:00
✨ migration for timestamp migrations
This commit is contained in:
15
util/src/migrations/1634426540271-MigrationTimestamp.ts
Normal file
15
util/src/migrations/1634426540271-MigrationTimestamp.ts
Normal file
@@ -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> {}
|
||||
}
|
||||
@@ -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(),
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user