]> pd.if.org Git - zpackage/blob - db.sql
large commit of C work
[zpackage] / db.sql
1 begin;
2
3 PRAGMA application_id = 0x5a504442;
4 PRAGMA user_version = 1;
5
6 -- should be faster with rowid due to the blob content
7 CREATE TABLE files (
8         hash text primary key,
9         size integer,
10         compression text,
11         content blob
12 )
13 ;
14
15 create table packages (
16         package text,
17         version text, -- the upstream version string
18         release integer, -- the local release number
19         description     text,
20         architecture    text,
21         url     text,
22         licenses        text, -- hash of actual license?  need table for more than one?
23         packager        text,
24         build_time      integer default (strftime('%s', 'now')),
25         install_time    integer,
26         primary key (package,version,release)
27 )
28 without rowid
29 ;
30
31 create table packagefiles (
32         package text,
33         version text,
34         release integer,
35         path    text,
36         mode    text, -- perms, use text for octal rep?
37         username        text, -- name of owner
38         groupname       text, -- group of owner
39         --filetype      integer default 0, -- 0 regular file, 1 directory, 2 symlink
40         -- regular file if null target and not null hash
41         -- except that we could not know the hash, or care
42         -- directory if null hash and null target
43         -- symlink if null hash and not null target
44         -- hard link if not null hash and not null target
45         -- device special files add dev number column
46         -- fifos add mode?  Can encode filetype in mode.
47         target  text, -- link target
48         hash    text, -- what should go here, null for dir?
49         mtime   integer, -- seconds since epoch, but allow finer?
50         primary key (package,version,release,path),
51         foreign key (package,version,release) references packages (package,version,release) on delete cascade
52 )
53 without rowid
54 ;
55
56 -- TODO just elf information?
57 -- and just hash, not package?
58 create table libraries (
59         package text,
60         subpackage      text,
61         path    text,
62         soname  text
63 )
64 ;
65
66 create table librarydeps (
67         package text,
68         subpackage      text,
69         path    text,
70         soname  text -- soname of dependency
71 );
72
73 -- package scripts: table of package, stage, file
74 create table scripts (
75         package text,
76         subpackage      text,
77         stage   text,
78         hash    text
79 );
80
81 -- package dependencies: table of package, dependency, dep type (package, soname)
82 create table packagedeps (
83         package text,
84         subpackage      text,
85         requires        text, -- package name
86         subreq  text, -- if requires only a sub package, probably most common for libs
87         minversion      text,
88         maxversion      text
89 );
90
91 -- capability labels
92 create table provides (
93         package text,
94         subpackage      text,
95         label   text -- a capability label
96 );
97
98 create table requires (
99         package text,
100         subpackage      text,
101         label   text -- a capability label
102 );
103
104 create table packagegroups (
105         package text,
106         "group" text
107 );
108 commit;