test and fix signal_camera upgrade problems

- after 3->4 upgrade, it left the foreign key referring to the
  nonexistent old_camera table. Likely no one who did the upgrade
  has ever inserted anything into this table, so no one's noticed.
- 6->7 upgrade dropped tables in the wrong order, so if there was
  anything in the signal_camera table, the upgrade would fail.
This commit is contained in:
Scott Lamb
2021-10-26 14:00:18 -07:00
parent 363fc8a267
commit 08cef6e790
3 changed files with 28 additions and 12 deletions

View File

@@ -457,10 +457,9 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
composite_id integer not null,
primary key (sample_file_dir_id, composite_id)
) without rowid;
drop index recording_cover;
insert into garbage select * from old_garbage;
drop table old_garbage;
drop index recording_cover;
alter table recording rename to old_recording;
create table recording (
composite_id integer primary key,
@@ -510,8 +509,8 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
video_index blob not null check (length(video_index) > 0)
);
insert into recording_playback select * from old_recording_playback;
drop table old_signal;
drop table signal_camera;
drop table old_signal;
drop table old_recording_playback;
drop table old_recording_integrity;
drop table old_recording;