mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-25 22:55:55 -05:00
tweak and document version 3->4 upgrade
This commit is contained in:
parent
4f25412c3f
commit
eaf6608597
@ -332,7 +332,7 @@ create table user (
|
|||||||
|
|
||||||
-- Permissions available for newly created tokens or when authenticating via
|
-- Permissions available for newly created tokens or when authenticating via
|
||||||
-- unix_uid above. A serialized "Permissions" protobuf.
|
-- unix_uid above. A serialized "Permissions" protobuf.
|
||||||
permissions blob
|
permissions blob not null default X''
|
||||||
);
|
);
|
||||||
|
|
||||||
-- A single session, whether for browser or robot use.
|
-- A single session, whether for browser or robot use.
|
||||||
@ -398,7 +398,7 @@ create table user_session (
|
|||||||
use_count not null default 0,
|
use_count not null default 0,
|
||||||
|
|
||||||
-- Permissions associated with this token; a serialized "Permissions" protobuf.
|
-- Permissions associated with this token; a serialized "Permissions" protobuf.
|
||||||
permissions blob
|
permissions blob not null default X''
|
||||||
) without rowid;
|
) without rowid;
|
||||||
|
|
||||||
create index user_session_uid on user_session (user_id);
|
create index user_session_uid on user_session (user_id);
|
||||||
@ -481,7 +481,7 @@ create table signal_change (
|
|||||||
-- delta: 1 1 196 (must be non-negative)
|
-- delta: 1 1 196 (must be non-negative)
|
||||||
-- states: 1 1 2
|
-- states: 1 1 2
|
||||||
-- varint: \x01 \x01 \x01 \x01 \xc4 \x01 \x02
|
-- varint: \x01 \x01 \x01 \x01 \xc4 \x01 \x02
|
||||||
changes blob
|
changes blob not null
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into version (id, unix_time, notes)
|
insert into version (id, unix_time, notes)
|
||||||
|
@ -58,13 +58,18 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
|
|||||||
primary key (signal_id, camera_id)
|
primary key (signal_id, camera_id)
|
||||||
) without rowid;
|
) without rowid;
|
||||||
|
|
||||||
create table signal_state (
|
create table signal_change (
|
||||||
time_90k integer primary key,
|
time_90k integer primary key,
|
||||||
changes blob
|
changes blob not null
|
||||||
);
|
);
|
||||||
|
|
||||||
alter table user add column permissions blob;
|
alter table user add column permissions blob not null default X'';
|
||||||
alter table user_session add column permissions blob;
|
alter table user_session add column permissions blob not null default X'';
|
||||||
|
|
||||||
|
-- Set permissions to "view_video" on existing users and sessions to preserve their
|
||||||
|
-- behavior. Newly created users won't have prepopulated permissions like this.
|
||||||
|
update user set permissions = X'0801';
|
||||||
|
update user_session set permissions = X'0801';
|
||||||
"#)?;
|
"#)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -222,3 +222,12 @@ Version 3 adds over version 1:
|
|||||||
separate uuid which has to be reserved in advance.
|
separate uuid which has to be reserved in advance.
|
||||||
* additional timestamp fields which may be useful in diagnosing/correcting
|
* additional timestamp fields which may be useful in diagnosing/correcting
|
||||||
time jumps/inconsistencies.
|
time jumps/inconsistencies.
|
||||||
|
|
||||||
|
### Version 3 to version 4
|
||||||
|
|
||||||
|
This upgrade affects only the SQLite database. Version 4 adds over version 3:
|
||||||
|
|
||||||
|
* permissions for users and sessions. Existing users will have only the
|
||||||
|
`view_video` permission, matching their previous behavior.
|
||||||
|
* the `signals` schema, used to store status of signals such as camera
|
||||||
|
motion detection, security system zones, etc.
|
||||||
|
Loading…
Reference in New Issue
Block a user