Migrating to the latest version of drizzle-kit.

import { defineConfig } from "drizzle-kit"

export default defineConfig({
dialect: 'postgresql',
dbCredentials: {
url: EnvConfig.DATABASE_URL,
},
// migrations:{
// table: "migrations",
// schema:'public',
// }
})
import { defineConfig } from "drizzle-kit"

export default defineConfig({
dialect: 'postgresql',
dbCredentials: {
url: EnvConfig.DATABASE_URL,
},
// migrations:{
// table: "migrations",
// schema:'public',
// }
})
import { migrate } from "drizzle-orm/postgres-js/migrator";
import { db } from "../config/db";

export const runMigrations = async () => {
await migrate(db, {
migrationsFolder: "./migrations",
});
};
import { migrate } from "drizzle-orm/postgres-js/migrator";
import { db } from "../config/db";

export const runMigrations = async () => {
await migrate(db, {
migrationsFolder: "./migrations",
});
};
drizzle-kit: v0.21.2 drizzle-orm: v0.30.10 No config path provided, using default 'drizzle.config.ts' Reading config file '/drizzle.config.ts' You have to provide 'schema' param why I'm getting this error and how do i provide 'schema' param?
2 Replies
Mykhailo
Mykhailo7mo ago
Hey @aspasht! You should define schema field in your config:
import { defineConfig } from "drizzle-kit"

export default defineConfig({
dialect: 'postgresql',
dbCredentials: {
url: EnvConfig.DATABASE_URL,
},
schema: 'your_path_to_schema',
// migrations:{
// table: "migrations",
// schema:'public',
// }
})
import { defineConfig } from "drizzle-kit"

export default defineConfig({
dialect: 'postgresql',
dbCredentials: {
url: EnvConfig.DATABASE_URL,
},
schema: 'your_path_to_schema',
// migrations:{
// table: "migrations",
// schema:'public',
// }
})
By the way, you can use new Drizzle kit command drizzle-kit migrate for applying migrations to the database. Also check docs to find more info about drizzle config. https://orm.drizzle.team/kit-docs/overview#configuration
Drizzle ORM - Overview
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
aspasht
aspashtOP7mo ago
thanks working now
Want results from more Discord servers?
Add your server