Jose Sanchez
Jose Sanchez
DTDrizzle Team
Created by Jose Sanchez on 6/29/2024 in #help
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.
2 replies