Jose Sanchez
DTDrizzle Team
•Created by Jose Sanchez on 6/29/2024 in #help
Drizzle-kit migrate
I tried with params and still the same:
config.ts
❯ 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'
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;
2 replies