uid integer, -- numeric uid, generally ignored
gid integer, -- numeric gid, generally ignored
configuration integer not null default 0, -- boolean if config file
+ confhash text, -- last hash on disk
filetype varchar not null default 'r',
-- r regular file
-- d directory
-- b block special -- not supported
-- c and b device special files add dev number column
-- p fifos (i.e. pipe) -- not supported
+ -- s unix domain socket -- not supported
target text, -- link target for links
- -- device file dev numbers
- devmajor integer,
- devminor integer,
+ device integer, -- device file dev_t
hash text, -- null if not a regular file
mtime integer, -- seconds since epoch, finer resolution not needed
primary key (package,version,release,path),
check (target is null or length(target) between 1 and 4095),
check (hash is null or length(hash) between 1 and 1024),
check (not (filetype = 'r' and hash is null)),
- check (not (filetype = 'c' and (devmajor is null or devminor is null))),
- check (not (filetype = 'b' and (devmajor is null or devminor is null))),
+ check (not (filetype = 'c' and device is null)),
+ check (not (filetype = 'b' and device is null)),
check (filetype in ('r','d','l','h','c','b','p')),
check(length(username) between 1 and 256),
check(length(groupname) between 1 and 256),
configuration = NEW.configuration,
filetype = NEW.filetype,
target = NEW.target,
- devmajor = NEW.devmajor,
- devminor = NEW.devminor,
+ device = NEW.device,
hash = NEW.hash,
mtime = NEW.mtime
where package = OLD.package
info text -- human readable
);
+create table notes (
+ id integer primary key, -- rowid alias
+ ts text default (strftime('%Y-%m-%d %H:%M:%f', 'now')),
+ note text not null,
+ pkgid text, -- package
+ path text, -- file path involved
+ file text, -- hash of file
+ ack integer default 0
+);
+
create table history (
ts integer, -- again, probably needs timestamp sub second
cmd text,
newfiles as (
select distinct
path,username,uid,groupname,gid,mode,filetype,mtime,hash,
- target,devminor,devmajor
+ configuration,target,device, null as ohash
from syncstatus SS
where path not in (select path from syncstatus where
rstatus in ('installed', 'updating', 'removing')
SS.path,
SS.username,
SS.uid, SS.groupname, SS.gid, SS.mode,
- SS.filetype, SS.mtime, SS.hash, SS.target, SS.devminor, SS.devmajor
+ SS.filetype, SS.mtime, SS.hash,SS.configuration, SS.target, SS.device,
+ null as ohash
from syncstatus SS
join syncstatus OS
on SS.path = OS.path and SS.pkgid is not OS.pkgid
preserve as (
select distinct
path,username,uid,groupname,gid,mode,filetype,mtime,hash,
- target,devminor,devmajor
+ configuration,target,device, null as ohash
from syncstatus SS
where path in (select library from needed)
and SS.rstatus in ('removing', 'removed')
remove as (
select distinct
path,username,uid,groupname,gid,mode,filetype,mtime,hash,
- target,devminor,devmajor
+ configuration,target,device, null as ohash
from syncstatus SS
where path not in (
select path from syncstatus where
expired as (
select distinct
path,username,uid,groupname,gid,mode,filetype,mtime,hash,
- target,devminor,devmajor
+ configuration,target,device, null as ohash
from syncstatus BASE
where hash in (select file from elflibraries where file is not null)
and path not in (select path from preserve)