From d48b0ba0315d228037affa1a529a644a321b295f Mon Sep 17 00:00:00 2001
From: valleet01 <thibaut.vallee@unicaen.fr>
Date: Fri, 22 Oct 2021 09:25:44 +0200
Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jours=20des=20cripts=20de=20cr?=
 =?UTF-8?q?=C3=A9ations=20des=20tables?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 SQL/001_tables.sql | 43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/SQL/001_tables.sql b/SQL/001_tables.sql
index 1772d01..51d9165 100755
--- a/SQL/001_tables.sql
+++ b/SQL/001_tables.sql
@@ -6,31 +6,38 @@ create table unicaen_renderer_macro
     code varchar(256) not null,
     description text,
     variable_name varchar(256) not null,
-    methode_name varchar(256) not null,
+    methode_name varchar(256) not null
 );
 create unique index unicaen_document_macro_code_uindex on unicaen_renderer_macro (code);
 create unique index unicaen_document_macro_id_uindex on unicaen_renderer_macro (id);
 
--- TABLE DES CONTENUS
+-- TABLE DES TEMPLATES
 
-create table unicaen_renderer_content
+create table unicaen_renderer_template
 (
-	id serial not null constraint unicaen_content_content_pk primary key,
-	code varchar(256) not null,
-	description text,
-	renderer_type varchar(256) not null,
-	renderer_complement text not null,
-	renderer_content text not null,
-	histo_creation timestamp not null,
-	histo_createur_id integer not null constraint unicaen_content_content_user_id_fk references "user",
-	histo_modification timestamp not null,
-	histo_modificateur_id integer not null constraint unicaen_content_content_user_id_fk_2 references "user",
-	histo_destruction timestamp,
-	histo_destructeur_id integer constraint unicaen_content_content_user_id_fk_3 references "user"
+    id serial not null constraint unicaen_document_template_pk primary key,
+    code varchar(256) not null,
+    description text,
+    document_type varchar(256) not null,
+    document_sujet text not null,
+    document_corps text not null,
+    document_css text not null
 );
+create unique index unicaen_document_template_code_uindex on unicaen_renderer_template (code);
+create unique index unicaen_document_template_id_uindex on unicaen_renderer_template (id);
 
-create unique index unicaen_content_content_id_uindex on unicaen_renderer_content (id);
-create unique index unicaen_content_content_code_uindex on unicaen_renderer_content (code);
-
+-- TABLE DES RENDU
+create table unicaen_renderer_rendu
+(
+    id serial not null constraint unicaen_document_rendu_pk primary key,
+    template_id int default null
+        constraint unicaen_document_rendu_template_id_fk
+            references unicaen_renderer_template
+            on delete set null,
+    date_generation timestamp not null,
+    document_sujet text not null,
+    document_corps text not null
+);
+create unique index unicaen_document_rendu_id_uindex on unicaen_renderer_rendu (id);
 
 
-- 
GitLab