Open Hiram-Wong opened 4 weeks ago
drizzle does not create tables automatically, you need to use drizzle-kit set migration.
this should do it
import { drizzle } from 'drizzle-orm/pglite'
import { migrate } from 'drizzle-orm/pglite/migrator'
// ...
const databaseInstance = drizzle({
client: pgClient,
schema
})
export function migrateAfterClientReady() {
if (!client.ready) await client.waitReady
await migrate(databaseInstance, {
migrationsFolder: path.resolve('src/shared/drizzle/'), // set to your drizzle generated path
migrationsSchema: path.resolve('src/shared/db/schema'), // set to your schema path
migrationsTable: '__migrations'
})
}
migrateAfterClientReady();
error
UnhandledPromiseRejectionWarning: error: relation "setting" does not exist