✨ migration for timestamp migrations
This commit is contained in:
parent
f0c17bb28f
commit
860e86ad19
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) => ({
|
connection.migrations.map((x) => ({
|
||||||
id: i++,
|
id: i++,
|
||||||
name: x.name,
|
name: x.name,
|
||||||
timestamp: Math.floor(Date.now() / 1000),
|
timestamp: Date.now(),
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user