From fef9d5d5d69d54fa3943fe14118bfaee6c42e6c8 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 25 Feb 2013 11:53:26 +0100 Subject: [PATCH] fix schema --- {doc => share}/schema.sql | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) rename {doc => share}/schema.sql (57%) diff --git a/doc/schema.sql b/share/schema.sql similarity index 57% rename from doc/schema.sql rename to share/schema.sql index d69e9fe..c644b44 100644 --- a/doc/schema.sql +++ b/share/schema.sql @@ -1,24 +1,26 @@ BEGIN TRANSACTION; CREATE TABLE source_files ( id INTEGER PRIMARY KEY, - filename TEXT UNIQUE COLLATE NOT NULL, + filename TEXT UNIQUE NOT NULL, size INTEGER NOT NULL, hash TEXT, - last_change INTEGER NOT NULL DEFAULT (strftime('%s','now')) + last_change INTEGER NOT NULL DEFAULT (strftime('%s','now')), last_seen INTEGER NOT NULL DEFAULT (strftime('%s','now')) ); CREATE TABLE destinations ( id INTEGER PRIMARY KEY, - path TEXT UNIQUE COLLATE NOT NULL + path TEXT UNIQUE NOT NULL ); CREATE TABLE destination_files ( id INTEGER PRIMARY KEY, - filename TEXT UNIQUE COLLATE NOT NULL, + filename TEXT UNIQUE NOT NULL, last_change INTEGER NOT NULL DEFAULT (strftime('%s','now')), to_delete NOT NULL DEFAULT 0, update_needed NOT NULL DEFAULT 1, - FOREIGN KEY(source_file) REFERENCES source_files(id), - FOREIGN KEY(destination) REFERENCES destinations(id) + source_file_id INTEGER, + destination_id INTEGER, + FOREIGN KEY (source_file_id) REFERENCES source_files(id), + FOREIGN KEY (destination_id) REFERENCES destinations(id) ); COMMIT;