diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-03-16 11:22:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 11:22:42 +0100 |
commit | b950072a3109d2c13881611a3950baa191caf097 (patch) | |
tree | ccfc5c2c26c56a496d0f34b3f4db0965c713e7bb /schema.sql | |
parent | 48a9ac895b6e8b01622810ec4bf2f3a423426ca3 (diff) | |
parent | 6350610ef5f7d73680853d39898094f2bf15febb (diff) |
Merge pull request #11 from gico-net/feat/add-repositories
Add CRUD for repository
Diffstat (limited to 'schema.sql')
-rw-r--r-- | schema.sql | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/schema.sql b/schema.sql new file mode 100644 index 0000000..9daa7f9 --- /dev/null +++ b/schema.sql @@ -0,0 +1,31 @@ +CREATE TABLE "repository" ( + id uuid PRIMARY KEY NOT NULL, + url varchar(255) UNIQUE NOT NULL, + created_at timestamp NOT NULL, + updated_at timestamp NOT NULL, + uploader_ip varchar(15) NOT NULL +); + +CREATE TABLE "email"( + email varchar(120) PRIMARY KEY NOT NULL, + hash_md5 varchar(32) UNIQUE NOT NULL +); + +CREATE TABLE "commit" ( + hash varchar(40) PRIMARY KEY NOT NULL, + tree varchar(40) REFERENCES commit(hash) NULL, + text text NOT NULL, + date timestamp NOT NULL, + author_email varchar(120) REFERENCES email(email) NOT NULL, + author_name varchar(120) NOT NULL, + committer_email varchar(120) REFERENCES email(email) NOT NULL, + committer_name varchar(120) NOT NULL, + repository_url varchar(256) REFERENCES repository(url) NOT NULL +); + +CREATE TABLE "branch" ( + id uuid PRIMARY KEY NOT NULL, + name varchar(120) NOT NULL, + repository_id uuid REFERENCES repository(id) NOT NULL, + head varchar(40) REFERENCES commit(hash) NULL +); |