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 '-'
31 licenses text, -- hash of actual license? need table for more than one?
33 build_time integer default (strftime('%s', 'now')),
35 checksum text, -- checksum of package contents. null for incompleted packages
36 primary key (package,version,release)
41 -- packagefile hash is columns as text, joined with null bytes, then
43 -- package checksum is package columns as text, joined with null bytes,
44 -- other than the checksum and install_time column
45 -- then that hashed. finally, that hash, plus the ascii sorted
46 -- hashes of the package files all joined with newlines, hashed.
47 -- really don't like this.
49 -- files contained in a package
50 create table packagefiles (
56 path text, -- filesystem path
57 mode text, -- perms, use text for octal rep?
58 username text, -- name of owner
59 groupname text, -- group of owner
60 uid integer, -- numeric uid, generally ignored
61 gid integer, -- numeric gid, generally ignored
62 filetype varchar default 'r',
66 -- h hard link -- not supported
67 -- c character special and b device special files add dev number column
69 -- p fifos (i.e. pipe)
70 target text, -- link target for links
71 -- device file dev numbers, should probably be a separate table
74 hash text, -- null if no actual content, i.e. anything but a regular file
75 mtime integer, -- seconds since epoch, finer resolution probably not needed
76 primary key (package,version,release,path),
77 foreign key (package,version,release) references packages (package,version,release) on delete cascade
82 create table pathtags (
88 path text, -- filesystem path
90 primary key (package,version,release,path,tag)
95 create table elfinfo (
96 file text, -- hash of blob
98 foreign key (file) references files on delete cascade
101 -- TODO just elf information?
102 -- and just hash, not package?
103 create table elflibraries (
104 file text primary key,
106 foreign key (file) references files on delete cascade
111 create table elfneeded (
113 needed text, -- soname of dependency
114 primary key (file, needed),
115 foreign key (file) references files on delete cascade
120 -- package scripts: table of package, stage, file
121 create table scripts (
129 -- package dependencies: table of package, dependency, dep type (package, soname)
130 create table packagedeps (
134 required text, -- package name
135 -- following can be null for not checked
143 create table provides (
146 label text -- a capability label
149 create table requires (
152 label text -- a capability label
155 create table packagegroups (
161 -- not sure how machine readable this needs to be,
162 -- do not at all for now, figure it out later
163 -- could be worth logging all commands in a history table,
164 -- the zpm driver could do that and capture the exit status
166 -- might want the history table to note a "group" to tie together
167 -- sub-invocations, probably an environment variable set if not
168 -- already set by zpm, probably a uuid or a timestamp
169 create table zpmlog (
170 ts integer, -- timestamp of action, may need sub-second
172 target text, -- packagename, repo name, etc
173 info text -- human readable
176 create table history (
177 ts integer, -- again, probably needs timestamp sub second
183 create table repository (
184 name text primary key, -- our name for a repo
186 priority integer not null default 1,
187 refreshed integer -- last refresh time
190 -- urls for downloading packages. possibly unneeded
191 create table repository_packages (
193 pkg text, -- glob pattern? in which case others not needed
199 -- track which repository a package was cloned from, i.e. where we got it
200 create table packagesource (
204 repository text references repository