How to add a schema migration
Modify https://github.com/advancedtelematic/aktualizr/tree/master/config/sql/schema.sql as you see fit
Write a config/sql/migration/migrate.n+1.sql that will convert an existing data to format in schema.sql. Note that old migrations must not be modified.
Make sure that the migrate.n+1.sql file updates the 'version' table:
DELETE FROM version; INSERT INTO version VALUES(...);
Write a config/sql/rollback/rollback.n+1.sql that will revert the new data format to the previous one. It should contain the opposite steps of migrate.n+1.sql if possible. If the reverse operation is lossy, it should at the minimum bring the device to a state where it can be updated.
The 'version' table has to be updated as well, to contain n.
If the migration manipulates existing data in a non-trivial way (anything that’s not simply a new table creation, deletion, renaming), it is strongly advised to write an explicit migration test with realistic data in https://github.com/advancedtelematic/aktualizr/tree/master/src/libaktualizr/storage/sqlstorage_test.cc, similar to