forked from seagle0128/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forge-database-v7-20220714-1140.sql
23 lines (23 loc) · 4.59 KB
/
forge-database-v7-20220714-1140.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
PRAGMA user_version=9;
PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE repository (class NOT NULL, id NOT NULL PRIMARY KEY, forge_id , forge , owner , name , apihost , githost , remote , sparse_p , created , updated , pushed , parent , description , homepage , default_branch , archived_p , fork_p , locked_p , mirror_p , private_p , issues_p , wiki_p , stars , watchers , assignees DEFAULT eieio_unbound, forks DEFAULT eieio_unbound, issues DEFAULT eieio_unbound, labels DEFAULT eieio_unbound, revnotes DEFAULT eieio_unbound, pullreqs DEFAULT eieio_unbound, selective_p , worktree , milestones DEFAULT eieio_unbound);
CREATE TABLE assignee (repository NOT NULL, id NOT NULL PRIMARY KEY, login , name , forge_id , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE fork (parent NOT NULL, id NOT NULL PRIMARY KEY, owner , name , FOREIGN KEY (parent) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE issue (class NOT NULL, id NOT NULL PRIMARY KEY, repository , number , state , author , title , created , updated , closed , unread_p , locked_p , milestone , body , assignees DEFAULT eieio_unbound, cards DEFAULT eieio_unbound, edits DEFAULT eieio_unbound, labels DEFAULT eieio_unbound, participants DEFAULT eieio_unbound, posts DEFAULT eieio_unbound, reactions DEFAULT eieio_unbound, timeline DEFAULT eieio_unbound, marks DEFAULT eieio_unbound, note , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE issue_assignee (issue NOT NULL, id NOT NULL, FOREIGN KEY (issue) REFERENCES issue (id) ON DELETE CASCADE);
CREATE TABLE issue_label (issue NOT NULL, id NOT NULL, FOREIGN KEY (issue) REFERENCES issue (id) ON DELETE CASCADE, FOREIGN KEY (id) REFERENCES label (id) ON DELETE CASCADE);
CREATE TABLE issue_mark (issue NOT NULL, id NOT NULL, FOREIGN KEY (issue) REFERENCES issue (id) ON DELETE CASCADE, FOREIGN KEY (id) REFERENCES mark (id) ON DELETE CASCADE);
CREATE TABLE issue_post (class NOT NULL, id NOT NULL PRIMARY KEY, issue , number , author , created , updated , body , edits DEFAULT eieio_unbound, reactions DEFAULT eieio_unbound, FOREIGN KEY (issue) REFERENCES issue (id) ON DELETE CASCADE);
CREATE TABLE label (repository NOT NULL, id NOT NULL PRIMARY KEY, name , color , description , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE mark (repository , id NOT NULL PRIMARY KEY, name , face , description );
CREATE TABLE milestone (repository NOT NULL, id NOT NULL PRIMARY KEY, number , title , created , updated , due , closed , description , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE notification (class NOT NULL, id NOT NULL PRIMARY KEY, thread_id , repository , forge , reason , unread_p , last_read , updated , title , type , topic , url , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE pullreq (class NOT NULL, id NOT NULL PRIMARY KEY, repository , number , state , author , title , created , updated , closed , merged , unread_p , locked_p , editable_p , cross_repo_p , base_ref , base_repo , head_ref , head_user , head_repo , milestone , body , assignees DEFAULT eieio_unbound, cards DEFAULT eieio_unbound, commits DEFAULT eieio_unbound, edits DEFAULT eieio_unbound, labels DEFAULT eieio_unbound, participants DEFAULT eieio_unbound, posts DEFAULT eieio_unbound, reactions DEFAULT eieio_unbound, review_requests DEFAULT eieio_unbound, reviews DEFAULT eieio_unbound, timeline DEFAULT eieio_unbound, marks DEFAULT eieio_unbound, note , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
CREATE TABLE pullreq_assignee (pullreq NOT NULL, id NOT NULL, FOREIGN KEY (pullreq) REFERENCES pullreq (id) ON DELETE CASCADE);
CREATE TABLE pullreq_label (pullreq NOT NULL, id NOT NULL, FOREIGN KEY (pullreq) REFERENCES pullreq (id) ON DELETE CASCADE, FOREIGN KEY (id) REFERENCES label (id) ON DELETE CASCADE);
CREATE TABLE pullreq_mark (pullreq NOT NULL, id NOT NULL, FOREIGN KEY (pullreq) REFERENCES pullreq (id) ON DELETE CASCADE, FOREIGN KEY (id) REFERENCES mark (id) ON DELETE CASCADE);
CREATE TABLE pullreq_post (class NOT NULL, id NOT NULL PRIMARY KEY, pullreq , number , author , created , updated , body , edits DEFAULT eieio_unbound, reactions DEFAULT eieio_unbound, FOREIGN KEY (pullreq) REFERENCES pullreq (id) ON DELETE CASCADE);
CREATE TABLE pullreq_review_request (pullreq NOT NULL, id NOT NULL, FOREIGN KEY (pullreq) REFERENCES pullreq (id) ON DELETE CASCADE);
CREATE TABLE revnote (class NOT NULL, id NOT NULL PRIMARY KEY, repository , "commit" , file , line , author , body , FOREIGN KEY (repository) REFERENCES repository (id) ON DELETE CASCADE);
COMMIT;