3 PRAGMA application_id = 0x5a504442;
4 PRAGMA user_version = 1;
6 -- should be faster with rowid due to the blob content
7 -- these are really just blobs of data
8 -- TODO copyright and license information should probably
11 hash text primary key, -- sha256 of content
12 size integer, -- bigint? certainly need > 2GB
13 compression text, -- always xz?
18 -- information about packages
19 -- a package is identified by a package,version,release triple
20 create table packages (
21 -- primary key columns
23 version text, -- the upstream version string
24 release integer, -- the local release number
25 pkgid text, -- the three above joined with '-'
32 licenses text, -- hash of actual license? need table for more than one?
34 build_time integer default (strftime('%s', 'now')),
36 checksum text, -- checksum of package contents. null for incompleted packages
37 primary key (package,version,release)
42 -- handle package status history with a logging trigger.
43 create trigger logpkgstatus after update of status on packages
44 begin insert into zpmlog (action,target,info)
45 values (printf('status change %s %s', OLD.status, NEW.status),
46 printf('%s-%s-%s', NEW.package, NEW.version, NEW.release),
49 create table packagetags (
55 set_time integer default (strftime('%s', 'now')),
56 primary key (package,version,release,tag),
57 foreign key (package,version,release) references packages (package,version,release) on delete cascade
60 -- packagefile hash is columns as text, joined with null bytes, then
62 -- package checksum is package columns as text, joined with null bytes,
63 -- other than the checksum and install_time column
64 -- then that hashed. finally, that hash, plus the ascii sorted
65 -- hashes of the package files all joined with newlines, hashed.
66 -- really don't like this.
68 -- files contained in a package
69 create table packagefiles (
75 path text, -- filesystem path
76 mode text, -- perms, use text for octal rep?
77 username text, -- name of owner
78 groupname text, -- group of owner
79 uid integer, -- numeric uid, generally ignored
80 gid integer, -- numeric gid, generally ignored
81 filetype varchar default 'r',
85 -- h hard link -- not supported
86 -- c character special and b device special files add dev number column
88 -- p fifos (i.e. pipe)
89 target text, -- link target for links
90 -- device file dev numbers, should probably be a separate table
93 hash text, -- null if no actual content, i.e. anything but a regular file
94 mtime integer, -- seconds since epoch, finer resolution probably not needed
95 primary key (package,version,release,path),
96 foreign key (package,version,release) references packages (package,version,release) on delete cascade
101 create table pathtags (
107 path text, -- filesystem path
109 primary key (package,version,release,path,tag)
114 create table elfinfo (
115 file text primary key, -- hash of blob
117 foreign key (file) references files on delete cascade
122 create table elfdeps (
126 primary key (file, soname, dependency),
127 foreign key (file) references files on delete cascade
132 -- TODO just elf information?
133 -- and just hash, not package?
134 create table elflibraries (
135 file text primary key,
137 foreign key (file) references files on delete cascade
142 create table elfneeded (
144 needed text, -- soname of dependency
145 primary key (file, needed),
146 foreign key (file) references files on delete cascade
151 -- package scripts: table of package, stage, file
152 create table scripts (
160 -- package dependencies: table of package, dependency, dep type (package, soname)
161 create table packagedeps (
165 required text, -- package name
166 -- following can be null for not checked
174 create table provides (
177 label text -- a capability label
180 create table requires (
183 label text -- a capability label
186 create table packagegroups (
192 -- not sure how machine readable this needs to be,
193 -- do not at all for now, figure it out later
194 -- could be worth logging all commands in a history table,
195 -- the zpm driver could do that and capture the exit status
197 -- might want the history table to note a "group" to tie together
198 -- sub-invocations, probably an environment variable set if not
199 -- already set by zpm, probably a uuid or a timestamp
200 create table zpmlog (
201 ts text default (strftime('%Y-%m-%d %H:%M:%f', 'now')),
202 -- timestamp of action
204 target text, -- packagename, repo name, etc
205 info text -- human readable
208 create table history (
209 ts integer, -- again, probably needs timestamp sub second
215 create table repository (
216 name text primary key, -- our name for a repo
218 priority integer not null default 1,
219 refreshed integer -- last refresh time
222 -- urls for downloading packages. possibly unneeded
223 create table repository_packages (
225 pkg text, -- glob pattern? in which case others not needed
231 -- track which repository a package was cloned from, i.e. where we got it
232 create table packagesource (
236 repository text references repository