-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: duplicate key value violates unique constraint while creating multiple workflows #395
Conversation
Codecov Report
@@ Coverage Diff @@
## master #395 +/- ##
=======================================
Coverage 20.82% 20.82%
=======================================
Files 24 24
Lines 2170 2170
=======================================
Hits 452 452
Misses 1678 1678
Partials 40 40 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gauravgahlot I think you have to create a separate migration :) so if we have people running the previous version they will be able to move from the master to this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get time to test it yet, but from what I've seen, it should fix the issue. Scheme also looks sensible, though some explanation in commit message would be nice, so one don't have to figure it out on their own.
Reading the comment @invidian said I think it will be nice to actually have that documentation as a comment in the migration function itself! ❤️ |
This is probably a good idea in general for all migrations :D |
7423afc
to
86f3145
Compare
We can have multiple events generated at a given time, therefore the value of 'created_at' field will be same for each event. This violates the unique constraint on "events_pkey", when these events are add to the events table. The migration changes the primary key on events table from 'created_at' to `id`, which will always be unique for each event generated at any point in time. Signed-off-by: Gaurav Gahlot <[email protected]>
86f3145
to
f3a4074
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Why is this needed
Fixes: #379
How Has This Been Tested?
git clone https://github.com/kinvolk/terraform-provider-tinkerbell && cd terraform-provider-tinkerbell
docker-compose -f test/docker-compose.yml up -d
TF_ACC=1 TINKERBELL_GRPC_AUTHORITY=127.0.0.1:42113 TINKERBELL_CERT_URL=http://127.0.0.1:42114/cert go test -v -run=^TestAccWorkflow_.*$ -count 100 ./tinkerbell/