moonfire-nvr/db/upgrade
Scott Lamb 433be217ac improve test of upgrade from v0 on up; fix bugs
Now the test actually has a recording and garbage with matching files.
This caught a few problems in the upgrade procedure:

* it didn't work with foreign keys enabled because the new recording
  table was set up after the new camera table, and the old recording
  table was destroyed after the old camera table. And now I enable
  foreign keys all the time. Reorder the procedure to fix.

* the pathname manipulation in the v2 to v3 procedure was incorrect
  since my introduction of nix because I gave it a &[u8] with the
  trailing nul, where I should have used CStr::from_bytes_with_nul.

* it wasn't removing garbage files. It'd be most natural to do this
  in the v2 to v3 upgrade (with the rename) but I historically removed
  the table when upgrading to v2. I can't redefine the schema now, so
  do it unnaturally.

  I'm considering also renaming all uuid-like files on upgrade to v4/v5
  to clean up this mess automatically for installations that have
  already done this upgrade.
2019-07-21 22:49:50 -07:00
..
mod.rs improve test of upgrade from v0 on up; fix bugs 2019-07-21 22:49:50 -07:00
v0.sql schema comparison in new upgrade tests, "moonfire-nvr check" 2019-07-11 13:31:33 -07:00
v0_to_v1.rs improve test of upgrade from v0 on up; fix bugs 2019-07-21 22:49:50 -07:00
v1.sql schema comparison in new upgrade tests, "moonfire-nvr check" 2019-07-11 13:31:33 -07:00
v1_to_v2.rs improve test of upgrade from v0 on up; fix bugs 2019-07-21 22:49:50 -07:00
v2_to_v3.rs improve test of upgrade from v0 on up; fix bugs 2019-07-21 22:49:50 -07:00
v3.sql schema comparison in new upgrade tests, "moonfire-nvr check" 2019-07-11 13:31:33 -07:00
v3_to_v4.rs schema comparison in new upgrade tests, "moonfire-nvr check" 2019-07-11 13:31:33 -07:00
v4_to_v5.rs update deps 2019-07-17 14:32:09 -07:00