-
Notifications
You must be signed in to change notification settings - Fork 0
Database
Here you will find some information about the aim for the database, how is it organized, changes and next steps.
Pytrainer can work with both MySQL and SQLite databases. As default it uses SQLite because it is easier to configure although some functionalities are missed.
(Also look at the current/development DB layout including athletestats and equipment.)
This is how pytrainer's database looks like as of version 3 (for pytrainer 1.7.1):
Original diagram in Dia format
Currently SQLite has some limitations with foreign keys. As this feature was not implemented from the beginning, we tried to add it afterwards:
ALTER TABLE records ADD CONSTRAINT FK_RECORDS_SPORT FOREIGN KEY (sport) REFERENCES sports (id_sports);
ALTER TABLE laps ADD CONSTRAINT FK_LAPS_RECORD FOREIGN KEY (record) REFERENCES records (id_record);
Unfortunately after checking SQLite documentation about alter command we realize that is not possible to do it. Another option would be to implement it using triggers but this would affect performance and makes database more complicated.
One of the interesting things that pytrainer will incorporate in the next feature is described in ticket #12 "Capability to manage any kind of sport equipment". This will bring some changes in database to allow users introduce information about equipment used in their workouts.
Another one is #16 "Track data on the athlete"
