Migration issues
Hello, I'm using drizzel ORM for my expressjs app and I'm using postgresql with docker. when I try to run migrations. recieve this error: password authentication failed for user "postgres"
This is my dockerfile:
version: "3"
services:
db:
image: postgres
restart: always
volumes:
- ./data/db:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRES_DB=testDB
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
adminer:
image: adminer
restart: always
ports:
- 8080:8080
this is my migrate.ts:
import { Client, Pool } from "pg";
import { drizzle } from "drizzle-orm/node-postgres";
import { migrate } from "drizzle-orm/node-postgres/migrator";
import "dotenv/config";
const pool = new Pool({
connectionString:process.env.CONNECTION_STRING,
});
const db = drizzle(pool);
async function main() {
try {
console.log("migration started...");
console.log(process.env.CONNECTION_STRING)
await migrate(db, { migrationsFolder: "./drizzle" });
console.log("migration ended...");
process.exit(0);
} catch (error) {
console.error(
migration error:${error}
)
}
}
main().catch((err) => {
console.log(err);
process.exit(0);
});
CONNECTION_STRING="postgresql://postgres:postgres@localhost:5432/testDB?schema=public"0 Replies