X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=schema%2Fmain.sql;h=198017866547a2e705fc0be3324b9a0346bdda30;hb=HEAD;hp=c9c79a26e0f338920d9bfcf0894066a2ef23cc47;hpb=e88d7fd4b079dc423ac628539ee891fe6504f6ba;p=zpackage diff --git a/schema/main.sql b/schema/main.sql index c9c79a2..1980178 100644 --- a/schema/main.sql +++ b/schema/main.sql @@ -6,7 +6,7 @@ PRAGMA user_version = 1; -- TODO copyright and license information should probably -- go here CREATE TABLE files ( - hash text primary key, -- sha256 of content + hash text primary key, -- sha256 of (uncompressed) content size integer, -- bigint? certainly need > 2GB compression text, -- always xz? content blob @@ -15,11 +15,17 @@ CREATE TABLE files ( create view filerefs as select F.hash, -count(PF.hash) + count(S.hash) + count(EL.file) + count(N.file) as refcount +count(PF.hash) + count(S.hash) + count(EL.file) + count(N.file) + count(EN.file) as refcount, +count(PF.hash) as pfrefs, +count(S.hash) as scriptrefs, +count(EL.file) as librefs, +count(EN.file) as needrefs, +count(N.file) as noterefs from files F left join packagefiles PF on PF.hash = F.hash left join scripts S on S.hash = F.hash left join elflibraries EL on EL.file = F.hash +left join elfneeded EN on EN.file = F.hash left join notes N on N.file = F.hash group by F.hash ; @@ -325,13 +331,15 @@ select printf('%s-%s-%s', package, version, release) as pkgid, * from scripts ; --- package dependencies: table of package, dependency, dep type (package, soname) +-- package dependencies: table of package, dependency, dep type (package, + -- soname) +-- how to specify min/max/exact create table packagedeps ( package text, version text, release integer, - requires text, -- package, can be partial - primary key (package,version,release,package), + requires text, -- package, can be partial, minimum + primary key (package,version,release,requires), foreign key (package,version,release) references packages (package,version,release) on delete cascade on update cascade ); @@ -372,7 +380,7 @@ create table zpmlog ( create table notes ( id integer primary key, -- rowid alias - ts text default (strftime('%Y-%m-%d %H:%M:%f', 'now')), + ts text default (strftime('%Y-%m-%dT%H:%M:%f', 'now')), note text not null, pkgid text, -- package path text, -- file path involved