]> pd.if.org Git - zpackage/blobdiff - db.sql
integrate previous work
[zpackage] / db.sql
diff --git a/db.sql b/db.sql
index 75e5354809459683fda2c04872de6ebf04c1a0a1..0bdc6549131bcb981885767d62058e9f2be2bb27 100644 (file)
--- a/db.sql
+++ b/db.sql
@@ -8,9 +8,9 @@ PRAGMA user_version = 1;
 -- TODO copyright and license information should probably
 -- go here
 CREATE TABLE files (
-       hash text primary key,
-               size integer,
-               compression text,
+       hash text primary key, -- sha256 of content
+               size integer, -- bigint?  certainly need > 2GB
+               compression text, -- always xz?
                content blob
 )
 ;
@@ -22,6 +22,7 @@ create table packages (
        package text,
        version text, -- the upstream version string
        release integer, -- the local release number
+       pkgid   text, -- the three above joined with '-'
 
        -- metadata columns
        description     text,
@@ -37,8 +38,16 @@ create table packages (
 without rowid
 ;
 
+-- packagefile hash is columns as text, joined with null bytes, then
+-- sha256 sum of that
+-- package checksum is package columns as text, joined with null bytes,
+-- other than the checksum and install_time column
+-- then that hashed.  finally, that hash, plus the ascii sorted
+-- hashes of the package files all joined with newlines, hashed.
+-- really don't like this.
+
 -- files contained in a package
-create table packagefiles (
+create table paths (
        -- package id triple
        package text,
        version text,
@@ -70,7 +79,7 @@ create table packagefiles (
 without rowid
 ;
 
-create table packagefiletags (
+create table pathtags (
        -- package id triple
        package text,
        version text,
@@ -148,4 +157,42 @@ create table packagegroups (
        "group" text
 );
 
+-- zpm actions
+-- not sure how machine readable this needs to be,
+-- do not at all for now, figure it out later
+-- could be worth logging all commands in a history table,
+-- the zpm driver could do that and capture the exit status
+-- as well
+-- might want the history table to note a "group" to tie together
+-- sub-invocations, probably an environment variable set if not
+-- already set by zpm, probably a uuid or a timestamp
+create table zpmlog (
+       ts      integer, -- timestamp of action, may need sub-second
+       action  text,
+       target  text, -- packagename, repo name, etc
+       info    text -- human readable
+);
+
+create table history (
+       ts      integer, -- again, probably needs timestamp sub second
+       cmd     text,
+       args    text,
+       status  integer
+);
+
+create table repository (
+       name    text primary key, -- our name for a repo
+       url     text not null,
+       priority        integer not null default 1,
+       refreshed       integer -- last refresh time
+);
+
+-- track which repository a package was cloned from, i.e. where we got it
+create table packagesource (
+       name    text,
+       version text,
+       release integer,
+       repository      text references repository
+);
+
 commit;