Drizzle-kit migrate

I got this error running the migration on a postgresql database hosted on supabase in local:
pnpm drizzle-kit migrate --config src/config.ts
drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

Custom config path was provided, using 'src/config.ts'
Reading config file '/home/copydataai/Documents/Personal/order-manager/packages/db/src/config.ts'
Error Please provide required params for Postgres driver:
[✓] url: 'postgres://postgres:my-password@localhost:5432/order-manager'
pnpm drizzle-kit migrate --config src/config.ts
drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

Custom config path was provided, using 'src/config.ts'
Reading config file '/home/copydataai/Documents/Personal/order-manager/packages/db/src/config.ts'
Error Please provide required params for Postgres driver:
[✓] url: 'postgres://postgres:my-password@localhost:5432/order-manager'
this is my config.ts
import type { Config } from "drizzle-kit";
import { createEnv } from "@t3-oss/env-core";
import * as z from "zod";

const env = createEnv({
server: {
DB_HOST: z.string(),
DB_PORT: z.string(),
DB_NAME: z.string(),
DB_USERNAME: z.string(),
DB_PASSWORD: z.string(),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});

// Push requires SSL so use URL instead of username/password
export const connectionStr = new URL(
`postgres://${env.DB_HOST}:${env.DB_PORT}/${env.DB_NAME}`,
);
connectionStr.username = env.DB_USERNAME;
connectionStr.password = env.DB_PASSWORD;

export default {
schema: ["./src/schema/*"],
driver: "pg",
dialect: "postgresql",
dbCredentials: { url: connectionStr.href },
out: "./drizzle",
} satisfies Config;
import type { Config } from "drizzle-kit";
import { createEnv } from "@t3-oss/env-core";
import * as z from "zod";

const env = createEnv({
server: {
DB_HOST: z.string(),
DB_PORT: z.string(),
DB_NAME: z.string(),
DB_USERNAME: z.string(),
DB_PASSWORD: z.string(),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});

// Push requires SSL so use URL instead of username/password
export const connectionStr = new URL(
`postgres://${env.DB_HOST}:${env.DB_PORT}/${env.DB_NAME}`,
);
connectionStr.username = env.DB_USERNAME;
connectionStr.password = env.DB_PASSWORD;

export default {
schema: ["./src/schema/*"],
driver: "pg",
dialect: "postgresql",
dbCredentials: { url: connectionStr.href },
out: "./drizzle",
} satisfies Config;
Attached is my sql migration, I tested the sql in raw and It works, So I'm assuming is the driver or idk.
1 Reply
Jose Sanchez
Jose SanchezOP6mo ago
I tried with params and still the same:
pnpm drizzle-kit introspect --config=src/config.ts
drizzle-kit: v0.22.8
drizzle-orm: v0.31.2

Custom config path was provided, using 'src/config.ts'
Reading config file '/home/copydataai/Documents/Personal/order-manager/packages/db/src/config.ts'
Error Please provide required params for Postgres driver:
[✓] host: 'localhost'
[✓] port: '5432'
[✓] user: 'postgres'
[✓] password: 'my-password'
[✓] database: 'order-manager'
[✓] ssl: 'reject'
pnpm drizzle-kit introspect --config=src/config.ts
drizzle-kit: v0.22.8
drizzle-orm: v0.31.2

Custom config path was provided, using 'src/config.ts'
Reading config file '/home/copydataai/Documents/Personal/order-manager/packages/db/src/config.ts'
Error Please provide required params for Postgres driver:
[✓] host: 'localhost'
[✓] port: '5432'
[✓] user: 'postgres'
[✓] password: 'my-password'
[✓] database: 'order-manager'
[✓] ssl: 'reject'
config.ts
import type { Config } from "drizzle-kit";
import { createEnv } from "@t3-oss/env-core";
import * as z from "zod";

const env = createEnv({
server: {
DB_HOST: z.string(),
DB_PORT: z.string(),
DB_NAME: z.string(),
DB_USERNAME: z.string(),
DB_PASSWORD: z.string(),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});

// Push requires SSL so use URL instead of username/password
export const connectionStr = new URL(
`postgres://${env.DB_HOST}:${env.DB_PORT}/${env.DB_NAME}`,
);
connectionStr.username = env.DB_USERNAME;
connectionStr.password = env.DB_PASSWORD;

export default {
schema: ["./src/schema/*"],
driver: "pg",
dialect: "postgresql",
dbCredentials: {
host: env.DB_HOST,
port: env.DB_PORT,
user: env.DB_USERNAME,
password: env.DB_PASSWORD,
database: env.DB_NAME,
ssl: "reject",
},
out: "./drizzle",
strict: true,
introspect: {
casing: "camel",
},
} satisfies Config;
import type { Config } from "drizzle-kit";
import { createEnv } from "@t3-oss/env-core";
import * as z from "zod";

const env = createEnv({
server: {
DB_HOST: z.string(),
DB_PORT: z.string(),
DB_NAME: z.string(),
DB_USERNAME: z.string(),
DB_PASSWORD: z.string(),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});

// Push requires SSL so use URL instead of username/password
export const connectionStr = new URL(
`postgres://${env.DB_HOST}:${env.DB_PORT}/${env.DB_NAME}`,
);
connectionStr.username = env.DB_USERNAME;
connectionStr.password = env.DB_PASSWORD;

export default {
schema: ["./src/schema/*"],
driver: "pg",
dialect: "postgresql",
dbCredentials: {
host: env.DB_HOST,
port: env.DB_PORT,
user: env.DB_USERNAME,
password: env.DB_PASSWORD,
database: env.DB_NAME,
ssl: "reject",
},
out: "./drizzle",
strict: true,
introspect: {
casing: "camel",
},
} satisfies Config;
Want results from more Discord servers?
Add your server