From 0be32c2fc914e4e2519947837eddeaaa37cb52f1 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Thu, 11 Mar 2021 21:26:08 +0100
Subject: chapter5: add physic model

---
 chapters/physic.tex | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 chapters/physic.tex

(limited to 'chapters/physic.tex')

diff --git a/chapters/physic.tex b/chapters/physic.tex
new file mode 100644
index 0000000..1e923a9
--- /dev/null
+++ b/chapters/physic.tex
@@ -0,0 +1,34 @@
+Qui di seguito è riportato il \verb|dump| in SQL per la creazione delle tabelle all'interno di PostgreSQL
+\begin{lstlisting}[language=SQL]
+CREATE TABLE "repository" (
+    id serial PRIMARY KEY NOT NULL,
+    url varchar(255) UNIQUE NOT NULL,
+    created_date timestamp NOT NULL,
+    updated_date 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 serial PRIMARY KEY NOT NULL,
+    name varchar(120) NOT NULL,
+    repository_id integer REFERENCES repository(id) NOT NULL,
+    head varchar(40) REFERENCES commit(hash) NULL
+);
+\end{lstlisting}
\ No newline at end of file
-- 
cgit v1.2.3-18-g5258

