[db] Recreate v20 files table, so that new constraints take effect if upgrading

The constraints on songalbumid and songartistid where changed with v20, so we
need to make sure they take effect when upgrading.

This commit tries to do the table recreation like sqlite recommends and without
manually crafted copy queries that are probably prone to errors.

Since we are recreating anyway, this commit also reorders the columns slightly.

It also includes auto-drop/recreation of triggers (should really have been its
own commit) during upgrade, like is already done with indices.
This commit is contained in:
ejurgensen
2018-12-30 00:27:47 +01:00
parent 1de8f39264
commit a4c254e6e7
5 changed files with 422 additions and 125 deletions

View File

@@ -31,6 +31,9 @@
int
db_init_indices(sqlite3 *hdl);
int
db_init_triggers(sqlite3 *hdl);
int
db_init_tables(sqlite3 *hdl);