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, -- hash of blob
109 foreign key (file) references files on delete cascade
112 -- TODO just elf information?
113 -- and just hash, not package?
114 create table elflibraries (
115 file text primary key,
117 foreign key (file) references files on delete cascade
122 create table elfneeded (
124 needed text, -- soname of dependency
125 primary key (file, needed),
126 foreign key (file) references files on delete cascade
131 -- package scripts: table of package, stage, file
132 create table scripts (
140 -- package dependencies: table of package, dependency, dep type (package, soname)
141 create table packagedeps (
145 required text, -- package name
146 -- following can be null for not checked
154 create table provides (
157 label text -- a capability label
160 create table requires (
163 label text -- a capability label
166 create table packagegroups (
172 -- not sure how machine readable this needs to be,
173 -- do not at all for now, figure it out later
174 -- could be worth logging all commands in a history table,
175 -- the zpm driver could do that and capture the exit status
177 -- might want the history table to note a "group" to tie together
178 -- sub-invocations, probably an environment variable set if not
179 -- already set by zpm, probably a uuid or a timestamp
180 create table zpmlog (
181 ts integer, -- timestamp of action, may need sub-second
183 target text, -- packagename, repo name, etc
184 info text -- human readable
187 create table history (
188 ts integer, -- again, probably needs timestamp sub second
194 create table repository (
195 name text primary key, -- our name for a repo
197 priority integer not null default 1,
198 refreshed integer -- last refresh time
201 -- urls for downloading packages. possibly unneeded
202 create table repository_packages (
204 pkg text, -- glob pattern? in which case others not needed
210 -- track which repository a package was cloned from, i.e. where we got it
211 create table packagesource (
215 repository text references repository