foreign key (package,version,release) references packages (package,version,release) on delete cascade on update cascade,
check (not (filetype = 'l' and target is null)),
check (not (filetype = 'r' and hash is null)),
- check (not (filetype = 'c' and (devmajor is null or devminor 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 (configuration = 0 or configuration = 1)
)
without rowid
;
from packagefiles
;
+create trigger packagefiles_update_trigger instead of
+update on packagefiles_pkgid
+begin
+ update packages
+ set package = NEW.package,
+ version = NEW.version,
+ release = NEW.release,
+ path = NEW.path,
+ mode = NEW.mode,
+ username = NEW.username,
+ groupname = NEW.groupname,
+ uid = NEW.uid,
+ gid = NEW.gid,
+ configuration = NEW.configuration,
+ filetype = NEW.filetype,
+ target = NEW.target,
+ devmajor = NEW.devmajor,
+ devminor = NEW.devminor,
+ hash = NEW.hash,
+ mtime = NEW.mtime
+ where package = OLD.package
+ and version = OLD.version
+ and release = OLD.release
+ and path = OLD.path
+ ;
+end
+;
+
create view installed_ref_count as
select I.path, count(*) as refcount
from installedfiles I