fix: modify db seed to ensure extension exists before transaction#1013
Open
w0244079 wants to merge 1 commit intovercel:mainfrom
Open
fix: modify db seed to ensure extension exists before transaction#1013w0244079 wants to merge 1 commit intovercel:mainfrom
w0244079 wants to merge 1 commit intovercel:mainfrom
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
|
@w0244079 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
I had a similar issue and was going to submit a similar fix, but you were first! :D Thank you for fixing it! I'm not blocked but it might be confusing for other people. Hope this gets merged soon 🙏 |
|
this fix worked for me as well! Hopefully it can be merged soon!! |
|
This PR really needs to be merged. I was struggling with the same issue for the past 2 hours. Why is it still open. |
|
this is 9 months old, why is this not getting merged? do you need help maintaining this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1005
I was experiencing the same error as was reported in this issue and have submitted a PR to fix which worked for me.
The underlying issue with the seed script was that the CREATE EXTENSION IF NOT EXISTS "uuid-ossp" statement was being executed multiple times within separate seed functions (seedUsers, seedInvoices, seedCustomers, etc.), even though the extension is a one-time setup for the entire database. PostgreSQL does not allow the same extension to be created multiple times, and executing it within each function could still lead to conflicts when trying to insert the extension multiple times during a single database transaction. This caused the 23505 unique constraint violation error, as PostgreSQL detected the duplicate attempt to install the uuid-ossp extension. The solution was to move the extension creation outside of the transactional logic, ensuring it runs once before any other operations and preventing redundant attempts to create the extension.