drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
290 stars 17 forks source link

drizzle-kit generate:pg not working for example in docs #528

Open LukasDeco opened 2 months ago

LukasDeco commented 2 months ago

This is the main example in the docs and it doesn't work:

npm i -g drizzle-kit
drizzle-kit generate:pg --out migrations-folder --schema=./lib/schema.ts
...
Unrecognized options for command 'generate:pg': --out, --schema
akoenig1 commented 4 weeks ago

@LukasDeco I recently upgraded to 0.24.2 from 0.20.14 and ran into the same issue. It looks like the generate command changed slightly and instead of running generate:pg you have to specify postgres with the dialect flag. So running: drizzle-kit generate --dialect=postgresql --out=example/migrations/path --schema=example/schema/path worked for me.

https://orm.drizzle.team/kit-docs/commands

I can't remember where the example you cited from the docs was exactly but I didn't see it on that page so perhaps the team has updated it.

nicholaschun commented 1 week ago

@LukasDeco this should work with drizzle kit version ^0.24.2

npx drizzle-kit generate --config='./src/db/drizzle.config.ts

and your drizzle.config.ts file can look like this

export default {
  schema: './src/db/schema/', // this is a path to a folder where all schemas are located
  out: './src/db/migrations',
  dialect: 'postgresql'
} 
LukasDeco commented 1 week ago

thanks guys. We also got it working from using generate:pg. I just want this issue to encourage the team to update the docs at least... maybe they did get updated?