Closed icewind1991 closed 5 months ago
Thank you for your contribution! I'm not sure why you changed the max
function in the SQL queries; they were necessary...?
It would be cleaner to move the strings to separate functions (on statConfig
), taking the db name as a parameter. If other exceptions would be added, the code is better contained...
It would be cleaner to move the strings to separate functions (on statConfig), taking the db name as a parameter. If other exceptions would be added, the code is better contained...
Done
Thank you for your contribution! I'm not sure why you changed the max function in the SQL queries; they were necessary...?
I misunderstood the workouts <-> map_data relation to be 1-1.
From the code I'm not sure if the records logic was working previously, as there didn't seem to be any logic to make the selected workout id and date match the selected value. I've changed the records query to sort on the value so it returns the correct id and date.
To be clear, the workout <-> map_data relation SHOULD BE 1-1, but because of an error in my code (which should be fixed), this was not always the case... I'll add cleanup code to fix problems in the database too.
The cleanup and enforcement of the relation should be fixed in #102
I tested the code, and the sqlite part works as before; there are two more styling issues to be solved (I run the tests locally), if you don't mind fixing them:
pkg/database/gorm.go:109:7: string `postgres` has 4 occurrences, make it a constant (goconst)
case "postgres":
^
pkg/database/workouts.go:34: File is not `gofmt`-ed with `-s` (gofmt)
GPXData []byte `gorm:"type:text" json:"-"` // To be removed
Filename string `json:"-"` // To be removed
Checksum []byte `gorm:"default:'legacy'" json:"-"` // To be removed
should be fixed now
should be fixed now
Correct, all green for me - I'll let the github action run.
Thank you so much, also for your patience with my questions!
Wow nice thanks! Is there a way to migrate from an sqlite instance?
There are tools that help switch between database techs...