mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-03 06:22:32 -05:00
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:
@@ -27,13 +27,6 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
|
||||
color text
|
||||
);
|
||||
|
||||
create table signal_camera (
|
||||
signal_id integer references signal (id),
|
||||
camera_id integer references camera (id),
|
||||
type integer not null,
|
||||
primary key (signal_id, camera_id)
|
||||
) without rowid;
|
||||
|
||||
create table signal_change (
|
||||
time_90k integer primary key,
|
||||
changes blob not null
|
||||
@@ -69,6 +62,13 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
|
||||
from
|
||||
old_camera;
|
||||
|
||||
create table signal_camera (
|
||||
signal_id integer references signal (id),
|
||||
camera_id integer references camera (id),
|
||||
type integer not null,
|
||||
primary key (signal_id, camera_id)
|
||||
) without rowid;
|
||||
|
||||
alter table stream rename to old_stream;
|
||||
create table stream (
|
||||
id integer primary key,
|
||||
|
||||
Reference in New Issue
Block a user