1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
CREATE TABLE ajxp_changes (
seq INTEGER PRIMARY KEY AUTOINCREMENT,
repository_identifier TEXT,
node_id NUMERIC,
type TEXT,
source TEXT,
target TEXT
);
/* SEPARATOR */
CREATE TABLE ajxp_index (
node_id INTEGER PRIMARY KEY AUTOINCREMENT,
repository_identifier TEXT,
node_path TEXT,
bytesize NUMERIC,
md5 TEXT,
mtime NUMERIC
);
/* SEPARATOR */
CREATE TRIGGER LOG_DELETE AFTER DELETE ON ajxp_index
BEGIN
INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type) VALUES (old.repository_identifier, old.node_id, old.node_path, "NULL", "delete");
END;
/* SEPARATOR */
CREATE TRIGGER LOG_INSERT AFTER INSERT ON ajxp_index
BEGIN
INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type) VALUES (new.repository_identifier, new.node_id, "NULL", new.node_path, "create");
END;
/* SEPARATOR */
CREATE TRIGGER "LOG_UPDATE_CONTENT" AFTER UPDATE ON "ajxp_index" FOR EACH ROW WHEN old.node_path=new.node_path
BEGIN
INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type) VALUES (new.repository_identifier, new.node_id, old.node_path, new.node_path, "content");
END;
/* SEPARATOR */
CREATE TRIGGER "LOG_UPDATE_PATH" AFTER UPDATE ON "ajxp_index" FOR EACH ROW WHEN old.node_path!=new.node_path
BEGIN
INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type) VALUES (new.repository_identifier, new.node_id, old.node_path, new.node_path, "path");
END;
/* SEPARATOR */
ALTER TABLE "ajxp_log" ADD COLUMN "source" text;
CREATE TABLE IF NOT EXISTS ajxp_version (
db_build INT NOT NULL
);
INSERT INTO ajxp_version VALUES (60);
|