From 44a35e651741afb6c417da47d636e4380cdd225f Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Sat, 13 Mar 2021 10:17:02 +0100
Subject: feat: add get all repos from db

---
 schema.sql | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 schema.sql

(limited to 'schema.sql')

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
+);
-- 
cgit v1.2.3-18-g5258

