Closed chrisj-back2work closed 2 years ago
Hey! I think this is more of a Prisma issue because Blitz uses Prisma to run the migrations and other db related things also go through prisma.
Confirmed that before prisma migrate reset
, the extensions show up in both DBs; and after the command fails, the extensions are missing from main (but not shadow).
Hey! I think this is more of a Prisma issue because Blitz uses Prisma to run the migrations and other db related things also go through prisma.
I'll do some research on the prisma side -- will bring back a solution if I find one.
This is a known issue. The workaround is what I was already doing: add the CREATE EXTENSION language to the top of the migration.sql file
This is worthy of a small doco add. Assuming you accept PRs on doco, I'll try that.
Yes, we do! Here's the repo: https://github.com/blitz-js/blitzjs.com
I'm going to close this issue, as it's not strictly related to Blitz. Blitz uses Prisma, but all the issues with Prisma or the underlying database are mostly outside of Blitz control.
You're welcome to submit a PR to our docs if you have ideas on how to make the experience better (we could, for example, put a link to Prisma docs saying that "if you have problems with prisma/db, refer to their docs"?).
What is the problem?
Add-on data types like @db.Citext work on initial migration, not subsequent migrations.
Paste all your error logs here:
Paste all relevant code snippets here:
See detailed steps
What are detailed steps to reproduce this?
Delete existing db/migrations dir.
Create a new / empty Postgres DB and shadow DB.
Apply this configuration to both of the DBs:
Have fields in a Prisma model like:
Run an initial migration:
That works fine. Now with the db/migrations folder in place:
Create a new / empty Postgres DB and shadow DB.
Run an after-initial migration:
That fails with:
Run
blitz -v
and paste the output here:Please include below any other applicable logs and screenshots that show your problem:
If I manually add these lines to the top of my migration.sql file:
... the later migrations work.
It's not clear why that's needed, since these extensions were already installed.
Maybe Blitz is creating temporary DBs or schemas that don't have this add-on?
The solution could be, capture CREATE EXTENSION commands in migrate.sql