Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Drizzle Kit doesn't create a __drizzle_migrations table #416

Open
brogeby opened this issue May 17, 2024 · 0 comments
Open

[BUG] Drizzle Kit doesn't create a __drizzle_migrations table #416

brogeby opened this issue May 17, 2024 · 0 comments

Comments

@brogeby
Copy link

brogeby commented May 17, 2024

As the title says, I'm not getting a migrations table when running migrations. I have tried both drizzle-kit generate / push and going through suggested script via drizzle-orm. I'm using node-postgres as driver.
drizzle-kit: 0.21.1
drizzle-orm: 0.30.10

My config:

// drizzle.config.js
import 'dotenv/config'
import { defineConfig } from 'drizzle-kit'

/** @type { import("drizzle-kit").Config } */
export default defineConfig({
  schema: 'src/db/schema.*',
  out: 'src/db/migrations',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL,
  },
  verbose: true,
  strict: false,
  schemaFilter: ['public'],
})

// index.ts
import { drizzle } from 'drizzle-orm/node-postgres'
import { Client } from 'pg'
import * as schema from './schema'

export const client = new Client(process.env.DATABASE_URL)
export const db = drizzle(client, { schema })

// migrate.ts
import 'dotenv/config'
import { resolve } from 'path'
import { client, db } from './'
import { migrate } from 'drizzle-orm/node-postgres/migrator'
export default async () => {
  await client.connect()
  await migrate(db, { migrationsFolder: resolve(__dirname, './migrations') })
  await client.end()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant