Prisma Migrate - Can't add value to enum in Postgres Database
See original GitHub issueBug description
I have an enum value and I would like to expand the possible values. The migration file is created successfully, but when running the migration I get the following error:
ERROR: ALTER TYPE ... ADD cannot run inside a transaction block
How to reproduce
- Create a migration with an enum and run migrate
- Add a value to the enum, create a new migration, and try to run migrate
- See issue
Fix could be this: https://stackoverflow.com/questions/53149484/error-alter-type-add-cannot-run-inside-a-transaction-block
Expected behavior
An error is not thrown
Prisma information
enum ModelType { TEST_1 TEST_2 TEST_3 }
Environment & setup
Debian (mac) 11.3.1
Prisma Version
2.23.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Adding a new value to an existing ENUM Type In prisma
In Postgres it is a relative simple ALTER TYPE add value vvvv; The most difficult may be deciding the sort order you want....
Read more >About the shadow database - Prisma
When you run prisma migrate dev to create a new migration, Prisma Migrate uses the shadow database to: Detect schema drift, which means...
Read more >Working with scalar lists/arrays (Concepts) - Prisma
Unsetting the value of a scalar list. This method is available on MongoDB only in versions 3.11.1 and later. The following example demonstrates...
Read more >What is introspection? (Reference) - Prisma
This is most commonly the case when you're not using Prisma Migrate but perform schema migrations using plain SQL or another migration tool....
Read more >Prisma schema (Reference)
The Prisma schema is the main configuration file when using Prisma. It is typically called schema.prisma and contains your database connection and data ......
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
I was on PG 11. I ended up upgrading to 12 and it was fixed. I’m not sure the total marketshare for PG 11, so up to you if you think it’s worth fixing!
Could we fix this by always generating multiple
ALTER TYPE
s? It’s uglier, but it would work on all versions.