Migration continually recreated despite schema not changing - dbgenerated nextval
See original GitHub issueBug description
Schema is not changed but migration is continually recreated for a dbgenerated id:
id String @id @default(dbgenerated("'policy_'|| nextval('policy_seq')"))
I have tried various syntaxes to no avail.
Postgres shows it as:
id text COLLATE pg_catalog."default" NOT NULL DEFAULT ('policy_'::text || nextval('policy_seq'::regclass)),
How to reproduce
Add to schema with Postgres provider:
id String @id @default(dbgenerated("'policy_'|| nextval('policy_seq')"))
Expected behavior
Create an original migration but should not create any more subsequent migrations after the original one. Unfortunately it continually creates a new migration on prisma migrate dev
Prisma information
model Policy {
id String @id @default(dbgenerated("'policy_'|| nextval('policy_seq')"))
name String @unique
@@map("policy")
}
Environment & setup
- OS: MacOS
- Database: PostgreSQL
- Node.js version: 18
Prisma Version
4.2.0
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Prisma v4 breaks support for empty `dbgenerated()` - invalid ...
Worked just fine through prisma 3.15.2; prisma 4.0.0 onwards produces invalid migration with no schema change
Read more >Why is rails 5 adding nextval method in schema file?
This is a bit long of an answer, so I've broken it into sections. Buckle up! My theory. My guess is that your...
Read more >Sequences - Oracle to Aurora PostgreSQL Migration Playbook
CYCLE | NOCYCLE : Instructs a sequence to continue generating values despite reaching the maximum value or the minimum value. If the sequence...
Read more >#24533 (Changing an AutoField into an IntegerField leaks the ...
Change the primary key from an AutoField to an IntegerField: ... and recreate migrations, the sequence is dropped and recreated, avoiding a crash:...
Read more >Blog | ent
Lint migration files. Changes to your project's Ent schema almost always result in a modification of your database. If you are using Versioned...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That did actually fix the issue, thanks!
Thanks. That is fortunately pretty close to what Postgres shows itself 👍