tweak and document version 3->4 upgrade

This commit is contained in:
Scott Lamb
2019-06-20 16:03:59 -07:00
parent 4f25412c3f
commit eaf6608597
3 changed files with 21 additions and 7 deletions

View File

@@ -332,7 +332,7 @@ create table user (
-- Permissions available for newly created tokens or when authenticating via
-- unix_uid above. A serialized "Permissions" protobuf.
permissions blob
permissions blob not null default X''
);
-- A single session, whether for browser or robot use.
@@ -398,7 +398,7 @@ create table user_session (
use_count not null default 0,
-- Permissions associated with this token; a serialized "Permissions" protobuf.
permissions blob
permissions blob not null default X''
) without rowid;
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)
-- states: 1 1 2
-- varint: \x01 \x01 \x01 \x01 \xc4 \x01 \x02
changes blob
changes blob not null
);
insert into version (id, unix_time, notes)

View File

@@ -58,13 +58,18 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
primary key (signal_id, camera_id)
) without rowid;
create table signal_state (
create table signal_change (
time_90k integer primary key,
changes blob
changes blob not null
);
alter table user add column permissions blob;
alter table user_session add column permissions blob;
alter table user add column permissions blob not null default X'';
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(())
}