-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(coordinator): Add unique_end_date constraint to funding_rates
We only need one funding rate entry per `end_date`. Without this change we were getting a new duplicate entry per maker restart. We `DO NOTHING` on conflict to ensure that the actually new rows in the batch will be inserted if we encounter any conflicts.
- Loading branch information
Showing
3 changed files
with
6 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
coordinator/migrations/2024-06-06-045129_add_unique_end_date_constraint/down.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE funding_rates | ||
DROP CONSTRAINT IF EXISTS unique_end_date; |
2 changes: 2 additions & 0 deletions
2
coordinator/migrations/2024-06-06-045129_add_unique_end_date_constraint/up.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE funding_rates | ||
ADD CONSTRAINT unique_end_date UNIQUE (end_date); |
This file contains 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