-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
CREATE TABLE IF NOT EXISTS github_users ( | ||
id serial PRIMARY KEY, | ||
login text, -- the user name of the user, known as the `login` field in GitHub API responses | ||
type text check ( type IN ('user', 'organization') ) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS github_repositories ( | ||
id serial PRIMARY KEY, | ||
repo_name text, | ||
owner integer references github_users ON DELETE CASCADE | ||
); | ||
|
||
-- In the GitHub API, pull requests are considered issues, too. | ||
-- Therefore, we would group both pull requests and issues in a single | ||
-- table. For more information, read: | ||
-- https://docs.github.com/en/rest/reference/issues and | ||
-- https://docs.github.com/en/rest/reference/pulls | ||
CREATE TABLE IF NOT EXISTS github_issues ( | ||
id serial PRIMARY KEY, | ||
number integer, | ||
repo integer references github_repositories ON DELETE CASCADE, | ||
type text check ( type IN ('issue', 'pull_request') ) | ||
); | ||
|
||
/* | ||
TODO: | ||
* Add policies to restrict the users who can write into these | ||
tables (preferably, only the search or parser microservice | ||
should write). | ||
* Add bridge tables that connect this GitHub information to | ||
a posts table that contains the posts themselves. | ||
*/ |