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 create table packagestatus (
42 pkgid text primary key,
43 status text, -- installed installing removed upgraded
45 asof integer default (strftime('%s', 'now'))
48 create table packagetags (
54 set_time integer default (strftime('%s', 'now')),
55 primary key (package,version,release,tag),
56 foreign key (package,version,release) references packages (package,version,release) on delete cascade
59 -- packagefile hash is columns as text, joined with null bytes, then
61 -- package checksum is package columns as text, joined with null bytes,
62 -- other than the checksum and install_time column
63 -- then that hashed. finally, that hash, plus the ascii sorted
64 -- hashes of the package files all joined with newlines, hashed.
65 -- really don't like this.
67 -- files contained in a package
68 create table packagefiles (
74 path text, -- filesystem path
75 mode text, -- perms, use text for octal rep?
76 username text, -- name of owner
77 groupname text, -- group of owner
78 uid integer, -- numeric uid, generally ignored
79 gid integer, -- numeric gid, generally ignored
80 filetype varchar default 'r',
84 -- h hard link -- not supported
85 -- c character special and b device special files add dev number column
87 -- p fifos (i.e. pipe)
88 target text, -- link target for links
89 -- device file dev numbers, should probably be a separate table
92 hash text, -- null if no actual content, i.e. anything but a regular file
93 mtime integer, -- seconds since epoch, finer resolution probably not needed
94 primary key (package,version,release,path),
95 foreign key (package,version,release) references packages (package,version,release) on delete cascade
100 create table pathtags (
106 path text, -- filesystem path
108 primary key (package,version,release,path,tag)
113 create table elfinfo (
114 file text primary key, -- hash of blob
116 foreign key (file) references files on delete cascade
121 create table elfdeps (
125 primary key (file, soname, dependency),
126 foreign key (file) references files on delete cascade
131 -- TODO just elf information?
132 -- and just hash, not package?
133 create table elflibraries (
134 file text primary key,
136 foreign key (file) references files on delete cascade
141 create table elfneeded (
143 needed text, -- soname of dependency
144 primary key (file, needed),
145 foreign key (file) references files on delete cascade
150 -- package scripts: table of package, stage, file
151 create table scripts (
159 -- package dependencies: table of package, dependency, dep type (package, soname)
160 create table packagedeps (
164 required text, -- package name
165 -- following can be null for not checked
173 create table provides (
176 label text -- a capability label
179 create table requires (
182 label text -- a capability label
185 create table packagegroups (
191 -- not sure how machine readable this needs to be,
192 -- do not at all for now, figure it out later
193 -- could be worth logging all commands in a history table,
194 -- the zpm driver could do that and capture the exit status
196 -- might want the history table to note a "group" to tie together
197 -- sub-invocations, probably an environment variable set if not
198 -- already set by zpm, probably a uuid or a timestamp
199 create table zpmlog (
200 ts integer, -- timestamp of action, may need sub-second
202 target text, -- packagename, repo name, etc
203 info text -- human readable
206 create table history (
207 ts integer, -- again, probably needs timestamp sub second
213 create table repository (
214 name text primary key, -- our name for a repo
216 priority integer not null default 1,
217 refreshed integer -- last refresh time
220 -- urls for downloading packages. possibly unneeded
221 create table repository_packages (
223 pkg text, -- glob pattern? in which case others not needed
229 -- track which repository a package was cloned from, i.e. where we got it
230 create table packagesource (
234 repository text references repository