summaryrefslogtreecommitdiff
path: root/schema.sql
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2013-08-02 15:21:56 +0200
committerHelmut Grohne <helmut@subdivi.de>2013-08-02 15:21:56 +0200
commit7528af6d22d3967be9727f6e2d88dfcbf0f78ce9 (patch)
tree40f16ad103c89240cc68f6eaa35d278af42fb9ae /schema.sql
parent2712edb550968ce7ec8cd9800241d7944666631a (diff)
downloaddebian-dedup-7528af6d22d3967be9727f6e2d88dfcbf0f78ce9.tar.gz
model comparability as an equivalence relation
webapp has had a relation hash_functions, that modeled "comparable functions". Images should not be compares to other files, since it makes no sense to store them as the RGBA stream, that is being hashed. This comparability property resembles an equivalence relation. So the function table gains a column eqclass. Each class is represented by a number and functions are statically assigned to these classes. Now the filtering happens in SQL instead of Python.
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql4
1 files changed, 2 insertions, 2 deletions
diff --git a/schema.sql b/schema.sql
index ddc6ccd..2ab7ca7 100644
--- a/schema.sql
+++ b/schema.sql
@@ -1,7 +1,7 @@
CREATE TABLE package (id INTEGER PRIMARY KEY, name TEXT UNIQUE, version TEXT, architecture TEXT, source TEXT);
CREATE TABLE content (id INTEGER PRIMARY KEY, pid INTEGER, filename TEXT, size INTEGER, FOREIGN KEY (pid) REFERENCES package(id) ON DELETE CASCADE);
-CREATE TABLE function (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL);
-INSERT INTO function (name) VALUES ("sha512"), ("gzip_sha512"), ("png_sha512"), ("gif_sha512");
+CREATE TABLE function (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL, eqclass INTEGER);
+INSERT INTO function (name, eqclass) VALUES ("sha512", 1), ("gzip_sha512", 1), ("png_sha512", 2), ("gif_sha512", 2);
CREATE TABLE hash (cid INTEGER, fid INTEGER NOT NULL, hash TEXT, FOREIGN KEY (cid) REFERENCES content(id) ON DELETE CASCADE, FOREIGN KEY (fid) REFERENCES function(id));
CREATE TABLE dependency (pid INTEGER, required TEXT, FOREIGN KEY (pid) REFERENCES package(id) ON DELETE CASCADE);
CREATE INDEX content_package_size_index ON content (pid, size);