drizzle-kit push not working with pgSchema
Hello, this is my first time using Drizzle and am running into some problems pushing my schema out. I have the following
docker-compose.yaml
that is spinning up a Postgres instance alongside Adminer.
I am using a codebase first approach with Drizzle and have the following schema defined under the following path <project root>/drizzle/schema/auth.ts
And this is my drizzle.config.ts
:
I was able to successfully do drizzle-kit push
and I did this while my databse was running in a container. However, when I open up Adminer to inspect the database, I do not see my auth
schema shown in the UI nor any of the tables I have defined. Hoping someone can assist me here.
Thanks in advance!6 Replies
Not sure why the auth schema isnt showing up, but for me, I had huge issues with postgres and drizzlekit push when defining things inside of an object inside a list.
I would change to
this resolved quite a few issues for me.
For reference this is the github issue for this
https://github.com/drizzle-team/drizzle-orm/issues/3596
GitHub
[BUG]:Composite primary key not added to postgres schema when using...
Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.36.3 What version of drizzle-kit...
So I just changed my tables from
pgTable(tableDefinition)
to
and am experiencing the same issue.
I found this issue with no known workaround.
https://github.com/drizzle-team/drizzle-orm/issues/3476GitHub
[BUG]: Custom schema migrations are not working · Issue #3476 · dri...
Duplicate of this issue. Accidentally pushed it to the wrong repo. What version of drizzle-orm are you using? 0.29.1 What version of drizzle-kit are you using? 0.20.6 Describe the Bug I am new to d...
@Optio1 that's interesting! Thanks for looking into that. It's sad that using Postgres schemas/folders doesn't work as expected especially if we're trying to organize our tables properly.
@Optio1 I managed to find a workaround to this problem -- or maybe this is actually what is expected that we are supposed to do if we intend to make use of
pgSchema
in our codebases. I had to update my drizzle.config.ts
to the following:
The key field is schemaFilter
. Apparently, Drizzle Kit needs to be told what schemas it can manage in the given database. So for eveny pgSchema
created, its name has to be added to that list. The default behavior is it only works on the public
schema which is why drizzle-kit push
was basically a no-op when I was doing it before.Can confirm this worked for me as well. Curious where you found that, would be worth updating the docs to have a link to that.
Funny enough, it came up after me going back and forth with ChatGPT haha
😂 whatever works works. Thanks for figuring it out.