1CREATE TABLE issues ( 2 service TEXT NOT NULL CHECK(service <> ''), 3 id INTEGER NOT NULL CHECK(id > 0), 4 project TEXT NOT NULL CHECK(project <> ''), 5 is_mergerequest INTEGER NOT NULL CHECK(is_mergerequest IN (0,1)), 6 summary TEXT, 7 description TEXT, 8 type TEXT, 9 status TEXT, 10 parent TEXT, 11 epic TEXT, 12 components TEXT, 13 labels TEXT, 14 priority TEXT, 15 duedate TEXT, 16 versions TEXT, 17 updated INTEGER, 18 PRIMARY KEY (service, id, project, is_mergerequest) 19); 20 21CREATE TABLE issue_issues ( 22 service TEXT NOT NULL CHECK (service <> ''), 23 id INTEGER NOT NULL CHECK (id > 0), 24 project TEXT NOT NULL CHECK (project <> ''), 25 is_mergerequest INTEGER NOT NULL CHECK (is_mergerequest IN (0, 1)), 26 referenced_service TEXT NOT NULL CHECK (referenced_service <> ''), 27 referenced_id INTEGER NOT NULL CHECK (referenced_id > 0), 28 referenced_project TEXT NOT NULL CHECK (referenced_project <> ''), 29 referenced_is_mergerequest INTEGER NOT NULL CHECK (referenced_is_mergerequest IN (0, 1)), 30 PRIMARY KEY (service, id, project, is_mergerequest, referenced_service, referenced_id, referenced_project, referenced_is_mergerequest) 31); 32 33-- FIXME: What does it do? Do we need it? issues_queue 34CREATE TABLE issues_queue ( 35 service TEXT NOT NULL CHECK(service <> ''), 36 project TEXT NOT NULL CHECK(project <> ''), 37 id INTEGER NOT NULL CHECK(id > 0), 38 is_mergerequest INTEGER NOT NULL CHECK(is_mergerequest IN (0,1)), 39 PRIMARY KEY (service, project, id, is_mergerequest) 40); 41 42CREATE TABLE pagerev_issues ( 43 page TEXT NOT NULL CHECK(page <> ''), 44 rev INTEGER NOT NULL CHECK(rev > 0), 45 service TEXT NOT NULL CHECK(service <> ''), 46 project_id TEXT NOT NULL CHECK(project_id <> ''), 47 issue_id INTEGER NOT NULL,-- CHECK(issue_id > 0), 48 is_mergerequest INTEGER NOT NULL CHECK(is_mergerequest IN (0,1)), 49 type TEXT NOT NULL CHECK(type <> ''), 50 PRIMARY KEY (page, rev, service, project_id, issue_id, is_mergerequest, type), 51 FOREIGN KEY (service) REFERENCES issues (service), 52 FOREIGN KEY (project_id) REFERENCES issues(project), 53 FOREIGN KEY (issue_id) REFERENCES issues(id), 54 FOREIGN KEY (is_mergerequest) REFERENCES issues(is_mergerequest), 55 FOREIGN KEY (page) REFERENCES pagerevs(page), 56 FOREIGN KEY (rev) REFERENCES pagerevs(rev) 57); 58 59CREATE TABLE webhooks ( 60 service TEXT NOT NULL CHECK(service <> ''), 61 repository_id TEXT NOT NULL CHECK(repository_id <> ''), 62 id TEXT NOT NULL CHECK(id <> ''), 63 secret TEXT NOT NULL CHECK(secret <> ''), 64 PRIMARY KEY (service, repository_id, id) 65); 66 67