mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: refactoring logs and adding pino logger for production and dev. (#236)
This commit is contained in:
+6
-3
@@ -17,12 +17,15 @@ import * as storagePolicy from "@/db/schema/13_storage-policy";
|
||||
import * as backupStorage from "@/db/schema/14_storage-backup";
|
||||
import * as healthcheckLog from "@/db/schema/15_healthcheck-log";
|
||||
|
||||
const log = logger.child({module: "db"});
|
||||
|
||||
|
||||
import {Pool} from "pg";
|
||||
|
||||
// Do not delete
|
||||
import dotenv from "dotenv";
|
||||
import {migrate} from "drizzle-orm/node-postgres/migrator";
|
||||
import {logger} from "@/lib/logger";
|
||||
|
||||
dotenv.config({
|
||||
path: ".env",
|
||||
@@ -66,12 +69,12 @@ export async function makeMigration() {
|
||||
|
||||
const database = drizzle({client: pool});
|
||||
|
||||
console.log("Running migrations...");
|
||||
log.info("Running migrations...");
|
||||
try {
|
||||
await migrate(database, {migrationsFolder: "./src/db/migrations"});
|
||||
console.log("Migrations applied successfully.");
|
||||
log.info("Migrations applied successfully.");
|
||||
} catch (error) {
|
||||
console.error("Error applying migrations:", error);
|
||||
log.error({error: error}, "Error applying migrations:");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user