-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow identical ticks on one day (#340)
The schema enforces a unique index on {climbId, dateClimbed, style, userID, source}. This is meant to prevent duplicating ticks imported from mountain project. However, it also prevents logging such ticks when they are legitimate. The import procedure also deletes imported ticks before reimporting, so this was overly cautious. Change the schema so it does not enforce uniqueness in this way. Instead, add non-unique indexes on { userId } and { userId, climbId }. Add a db migration script. Remove climb uniqueness test. Fixes OpenBeta/open-tacos#631
- Loading branch information
Showing
3 changed files
with
13 additions
and
21 deletions.
There are no files selected for viewing
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,11 @@ | ||
/** | ||
* https://github.com/OpenBeta/open-tacos/issues/631 | ||
**/ | ||
|
||
rs1 = db.ticks.createIndex({ userId: -1 }) | ||
rs2 = db.ticks.createIndex({ userId: -1, climbId: -1 }) | ||
rs3 = db.ticks.dropIndex({ climbId: 1, dateClimbed: 1, style: 1, userId: 1, source: 1 }) | ||
|
||
printjson(rs1) | ||
printjson(rs2) | ||
printjson(rs3) |
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
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