SQL (sqlite) DB schema
This commit is contained in:
parent
194c707172
commit
9ec54b012c
24
doc/schema.sql
Normal file
24
doc/schema.sql
Normal file
@ -0,0 +1,24 @@
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE source_files (
|
||||
id INTEGER PRIMARY KEY,
|
||||
filename TEXT UNIQUE COLLATE NOT NULL,
|
||||
size INTEGER NOT NULL,
|
||||
hash TEXT,
|
||||
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
|
||||
);
|
||||
CREATE TABLE destination_files (
|
||||
id INTEGER PRIMARY KEY,
|
||||
filename TEXT UNIQUE COLLATE 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)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
Loading…
x
Reference in New Issue
Block a user