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 packagetags (
47 set_time integer default (strftime('%s', 'now')),
48 primary key (package,version,release,tag),
49 foreign key (package,version,release) references packages (package,version,release) on delete cascade
52 -- packagefile hash is columns as text, joined with null bytes, then
54 -- package checksum is package columns as text, joined with null bytes,
55 -- other than the checksum and install_time column
56 -- then that hashed. finally, that hash, plus the ascii sorted
57 -- hashes of the package files all joined with newlines, hashed.
58 -- really don't like this.
60 -- files contained in a package
61 create table packagefiles (
67 path text, -- filesystem path
68 mode text, -- perms, use text for octal rep?
69 username text, -- name of owner
70 groupname text, -- group of owner
71 uid integer, -- numeric uid, generally ignored
72 gid integer, -- numeric gid, generally ignored
73 filetype varchar default 'r',
77 -- h hard link -- not supported
78 -- c character special and b device special files add dev number column
80 -- p fifos (i.e. pipe)
81 target text, -- link target for links
82 -- device file dev numbers, should probably be a separate table
85 hash text, -- null if no actual content, i.e. anything but a regular file
86 mtime integer, -- seconds since epoch, finer resolution probably not needed
87 primary key (package,version,release,path),
88 foreign key (package,version,release) references packages (package,version,release) on delete cascade
93 create table pathtags (
99 path text, -- filesystem path
101 primary key (package,version,release,path,tag)
106 create table elfinfo (
107 file text primary key, -- hash of blob
109 foreign key (file) references files on delete cascade
114 create table elfdeps (
118 primary key (file, soname, dependency),
119 foreign key (file) references files on delete cascade
124 -- TODO just elf information?
125 -- and just hash, not package?
126 create table elflibraries (
127 file text primary key,
129 foreign key (file) references files on delete cascade
134 create table elfneeded (
136 needed text, -- soname of dependency
137 primary key (file, needed),
138 foreign key (file) references files on delete cascade
143 -- package scripts: table of package, stage, file
144 create table scripts (
152 -- package dependencies: table of package, dependency, dep type (package, soname)
153 create table packagedeps (
157 required text, -- package name
158 -- following can be null for not checked
166 create table provides (
169 label text -- a capability label
172 create table requires (
175 label text -- a capability label
178 create table packagegroups (
184 -- not sure how machine readable this needs to be,
185 -- do not at all for now, figure it out later
186 -- could be worth logging all commands in a history table,
187 -- the zpm driver could do that and capture the exit status
189 -- might want the history table to note a "group" to tie together
190 -- sub-invocations, probably an environment variable set if not
191 -- already set by zpm, probably a uuid or a timestamp
192 create table zpmlog (
193 ts integer, -- timestamp of action, may need sub-second
195 target text, -- packagename, repo name, etc
196 info text -- human readable
199 create table history (
200 ts integer, -- again, probably needs timestamp sub second
206 create table repository (
207 name text primary key, -- our name for a repo
209 priority integer not null default 1,
210 refreshed integer -- last refresh time
213 -- urls for downloading packages. possibly unneeded
214 create table repository_packages (
216 pkg text, -- glob pattern? in which case others not needed
222 -- track which repository a package was cloned from, i.e. where we got it
223 create table packagesource (
227 repository text references repository