Added custom logger that logs to db
This commit is contained in:
15
src/migrations/1770232943778-add_log_entity.ts
Normal file
15
src/migrations/1770232943778-add_log_entity.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddLogEntity1770232943778 implements MigrationInterface {
|
||||
name = 'AddLogEntity1770232943778';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "logs" ("id" SERIAL NOT NULL, "level" character varying NOT NULL, "message" character varying NOT NULL, "context" character varying, "timestamp" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_fb1b805f2f7795de79fa69340ba" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE "logs"`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user