Main idea (suggested by Dmitry, based on Ruby on Rails, I believe? And I (Tiar) think it's neat):
- one query to create a database
- a query to change the schema from 0.0.1 to 0.0.2
- a query to change the schema from 0.0.2 to 0.0.3
- etc.
- possibly flattening 0.0.1-0.n.m when we stop supporting anything below 0.n.m
- when the current version of Krita's database is 0.0.5 and there is no database file, then Krita just applies all queries in order: first the base query, then 0.0.1-0.0.2, then 0.0.2-0.0.3, etc. until it gets to 0.0.5
- when the current version of Krita's database is 0.0.5 and there is a database file of version 0.0.3, Krita just applies 0.0.3-0.0.4 guery, and then 0.0.4-0.0.5.
Questions:
- what is Halla's opinion about it?
- what are alternative ways of making the database migration system more clean/clear (right now it's a bit messy, since it's all manual in the code)?
- what about users who use Krita 5.1.0 and then go back to 5.0.2 and then 5.0.0-beta1 and then 5.1.0? (As in, what if "current" database version is smaller than the version of the existing file, because the current Krita version is older than the one that created or updated the database?) - while it's fine to not support this, it would be good to allow users to use nightly versions, so going at least two-three versions back should be possible without bad repercussions, if we can achieve that.