[mirrorbrain-commits] r8014 - in /trunk: mirrordoctor/mb/conn.py sql/schema-postgresql.sql

From: <poeml_at_mirrorbrain.org>
Date: Sat, 27 Mar 2010 02:08:41 -0000
Author: poeml
Date: Sat Mar 27 03:08:41 2010
New Revision: 8014

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8014&view=rev
Log:
database schema:
- add fields for zsync data to the hash table
- extend the hexhash table accordingly
- don't allow NULL values in sha1pieces
- rename the id column to file_id

Modified:
    trunk/mirrordoctor/mb/conn.py
    trunk/sql/schema-postgresql.sql

Modified: trunk/mirrordoctor/mb/conn.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mirrordoctor/mb/conn.py?rev=8014&r1=8013&r2=8014&view=diff
==============================================================================
--- trunk/mirrordoctor/mb/conn.py (original)
+++ trunk/mirrordoctor/mb/conn.py Sat Mar 27 03:08:41 2010
_at_@ -186,20 +186,31 @@
                     "sha1"   BYTEA NOT NULL,
                     "sha256" BYTEA NOT NULL,
                     "sha1piecesize" INTEGER NOT NULL,
-                    "sha1pieces" BYTEA,
-                    "pgp" TEXT NOT NULL
+                    "sha1pieces" BYTEA NOT NULL,
+                    "pgp" TEXT NOT NULL,
+                    "zblocksize" SMALLINT NOT NULL,
+                    "zhashlens" VARCHAR(8),
+                    "zsums" BYTEA NOT NULL
             );
             """
             Filearr._connection.query(query)
             query = """
-            CREATE VIEW hexhash AS
-              SELECT file_id, mtime, size,
-                     encode(md5, 'hex') AS md5,
-                     encode(sha1, 'hex') AS sha1,
-                     encode(sha256, 'hex') AS sha256,
-                     sha1piecesize,
-                     encode(sha1pieces, 'hex') AS sha1pieces,
-                     pgp
+            CREATE VIEW hexhash AS 
+              SELECT file_id, mtime, size, 
+                     md5,
+                     encode(md5, 'hex') AS md5hex, 
+                     sha1,
+                     encode(sha1, 'hex') AS sha1hex, 
+                     sha256,
+                     encode(sha256, 'hex') AS sha256hex, 
+                     sha1piecesize, 
+                     sha1pieces,
+                     encode(sha1pieces, 'hex') AS sha1pieceshex,
+                     pgp,
+                     zblocksize,
+                     zhashlens,
+                     zsums,
+                     encode(zsums, 'hex') AS zsumshex
               FROM hash;
             """
             Filearr._connection.query(query)

Modified: trunk/sql/schema-postgresql.sql
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/sql/schema-postgresql.sql?rev=8014&r1=8013&r2=8014&view=diff
==============================================================================
--- trunk/sql/schema-postgresql.sql (original)
+++ trunk/sql/schema-postgresql.sql Sat Mar 27 03:08:41 2010
_at_@ -23,15 +23,18 @@
 
 
 CREATE TABLE "hash" (
-        "id" INTEGER REFERENCES filearr PRIMARY KEY,
+        "file_id" INTEGER REFERENCES filearr PRIMARY KEY,
         "mtime" INTEGER NOT NULL,
         "size" BIGINT NOT NULL,
         "md5"    BYTEA NOT NULL,
         "sha1"   BYTEA NOT NULL,
         "sha256" BYTEA NOT NULL,
         "sha1piecesize" INTEGER NOT NULL,
-        "sha1pieces" BYTEA,
-        "pgp" TEXT NOT NULL
+        "sha1pieces" BYTEA NOT NULL,
+        "pgp" TEXT NOT NULL,
+        "zblocksize" SMALLINT NOT NULL,
+        "zhashlens" VARCHAR(8),
+        "zsums" BYTEA NOT NULL
 );
 
 -- For conveniency, this view provides the binary columns from the "hash" table
_at_@ -55,7 +58,11 @@
          sha1piecesize, 
          sha1pieces,
          encode(sha1pieces, 'hex') AS sha1pieceshex,
-         pgp 
+         pgp,
+         zblocksize,
+         zhashlens,
+         zsums,
+         encode(zsums, 'hex') AS zsumshex
   FROM hash;
 
 -- --------------------------------------------------------




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Sat Mar 27 2010 - 02:08:42 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT