rajah 9 сар өмнө
commit
811d08277f

+ 38 - 0
.gitignore

@@ -0,0 +1,38 @@
+.DS_Store
+HELP.md
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/

+ 50 - 0
postgresql/base.sql

@@ -0,0 +1,50 @@
+
+-- DROP ROLE IF EXISTS vote;
+CREATE ROLE vote WITH
+  LOGIN
+  NOSUPERUSER
+  INHERIT
+  NOCREATEDB
+  NOCREATEROLE
+  NOREPLICATION
+  NOBYPASSRLS
+  ENCRYPTED PASSWORD 'pharmago$2024';
+
+-- DROP TABLESPACE IF EXISTS vote;
+CREATE TABLESPACE vote OWNER vote LOCATION '/Users/Rajah/Documents/www.triplea.fr/vote/base';
+ALTER TABLESPACE vote OWNER TO vote;
+
+-- DROP DATABASE IF EXISTS vote;
+CREATE DATABASE vote WITH
+    OWNER = vote
+    TEMPLATE = postgres
+    ENCODING = 'UTF8'
+    LC_COLLATE = 'C'
+    LC_CTYPE = 'C'
+    TABLESPACE = vote
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE = False;
+
+\c vote
+
+-- DROP SCHEMA IF EXISTS vote ;
+CREATE SCHEMA IF NOT EXISTS vote AUTHORIZATION vote;
+
+\ir ./tables/variables.sql
+\ir ./tables/evenements.sql
+\ir ./tables/roles.sql
+\ir ./tables/privileges.sql
+\ir ./tables/roles_privileges.sql
+\ir ./tables/participants.sql
+\ir ./tables/participants_roles.sql
+\ir ./tables/messages.sql
+\ir ./tables/preferences.sql
+\ir ./tables/categories.sql
+\ir ./tables/productions.sql
+\ir ./tables/presentations.sql
+\ir ./tables/bulletins.sql
+
+\ir ./contenu/variables.sql
+\ir ./contenu/evenements.sql
+\ir ./contenu/roles.sql
+\ir ./contenu/privileges.sql

+ 17 - 0
postgresql/contenu/evenements.sql

@@ -0,0 +1,17 @@
+INSERT INTO vote.evenements (numero_evenement, libelle, lien, nom, numero_parent, numero_niveau, numero_ordre, script)
+VALUES
+	(1,  '<i class=\"fas fa-home\"></i>&nbsp;Accueil',                     '../servlet/menu?ttt=10100',  'Accueil',  0, 1, 100, null),
+	(3,  '<i class=\"fas fa-id-card-alt\"></i>&nbsp;Données personnelles', '../servlet/appli?ttt=10760', 'Données personnelles', 0, 1, 10000, null),
+	(4,  '<i class=\"fas fa-sign-out-alt\"></i>&nbsp;Se déconnecter',      '../servlet/acces?ttt=10002', 'Quitter', 0, 1, 99999, null),
+	(6,  '<i class=\"fas fa-cogs\"></i>&nbsp;Paramétrages',                'javascript:bascule(6);',     'Paramétrages', 0, 1, 9000, null),
+	(7,  '<i class=\"fas fa-sliders-h\"></i>&nbsp;Environnement',          '../servlet/appli?ttt=10703', 'Paramétrages > Variables', 6, 2, 9100, null),
+	(9,  '<i class=\"fas fa-users\"></i>&nbsp;Participants',               '../servlet/appli?ttt=10740', 'Participants', 0, 1, 8000, null),
+	(10, '<i class=\"fas fa-shield-alt\"></i>&nbsp;Privilèges',            '../servlet/appli?ttt=10750', 'Paramétrages > Privilèges', 6, 2, 9300, null),
+	(11, '<i class=\"fas fa-users-cog\"></i>&nbsp;Rôles',                  '../servlet/appli?ttt=10730', 'Paramétrages > Rôles', 6, 2, 9200, null),
+	(12, '<i class=\"fas fa-save\"></i>&nbsp;Productions',                 '../servlet/prod?ttt=10610',  'Productions', 0, 1, 3000, null),
+	(13, '<i class=\"fas fa-layer-group\"></i>&nbsp;Catégories',           '../servlet/compo?ttt=10710', 'Catégories', 0, 1, 4000, null),
+	(14, '<i class=\"fas fa-vote-yea\"></i>&nbsp;Voter',                   '../servlet/vote?ttt=10810',  'Voter', 0, 1, 5000, null),
+	(15, '<i class=\"fas fa-trophy\"></i>&nbsp;Résultats',                 '../servlet/stat?ttt=10930',  'Résultats', 0, 1, 6000, null),
+	(16, '<i class=\"fas fa-comments\"></i>&nbsp;Messagerie',              '../servlet/chat?ttt=11100',  'Messagerie',  0, 1, 500, 'var am=document.getElementById(''alert_msg'');if (am!=null) {am.classList.remove(''faa-flash'');am.classList.remove(''animated'');}return true;'),
+	(17, '<i class=\"fas fa-clock\"></i>&nbsp;Planning',                   '../servlet/menu?ttt=10103',  'Planning', 0, 1, 400, null),
+	(18, '<i class=\"fas fa-eye\"></i>&nbsp;Caméras',                      '../servlet/menu?ttt=10106',  'Caméras', 0, 1, 300, null);

+ 47 - 0
postgresql/tables/bulletins.sql

@@ -0,0 +1,47 @@
+CREATE TABLE IF NOT EXISTS vote.bulletins
+(
+    numero_bulletin integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    numero_categorie integer NOT NULL,
+    numero_participant integer NOT NULL,
+    numero_production01 integer DEFAULT NULL,
+    numero_production02 integer DEFAULT NULL,
+    numero_production03 integer DEFAULT NULL,
+    numero_production04 integer DEFAULT NULL,
+    numero_production05 integer DEFAULT NULL,
+    numero_production06 integer DEFAULT NULL,
+    numero_production07 integer DEFAULT NULL,
+    numero_production08 integer DEFAULT NULL,
+    numero_production09 integer DEFAULT NULL,
+    numero_production10 integer DEFAULT NULL,
+    flag_valide boolean DEFAULT false,
+    CONSTRAINT fk_numeroCategorieUrne FOREIGN KEY(numero_categorie) REFERENCES vote.categories(numero_categorie),
+    CONSTRAINT fk_numeroParticipantUrne FOREIGN KEY(numero_participant) REFERENCES vote.participants(numero_participant),
+    CONSTRAINT fk_numeroProduction01Urne FOREIGN KEY(numero_production01) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction02Urne FOREIGN KEY(numero_production02) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction03Urne FOREIGN KEY(numero_production03) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction04Urne FOREIGN KEY(numero_production04) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction05Urne FOREIGN KEY(numero_production05) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction06Urne FOREIGN KEY(numero_production06) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction07Urne FOREIGN KEY(numero_production07) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction08Urne FOREIGN KEY(numero_production08) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction09Urne FOREIGN KEY(numero_production09) REFERENCES vote.productions(numero_production),
+    CONSTRAINT fk_numeroProduction10Urne FOREIGN KEY(numero_production10) REFERENCES vote.productions(numero_production)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.bulletins OWNER to vote;
+
+ALTER TABLE IF EXISTS vote.bulletins ADD CONSTRAINT ix_ParticipantCategorieUrne UNIQUE (numero_categorie, numero_participant);
+
+CREATE INDEX IF NOT EXISTS ix_numeroCategorieUrne ON vote.bulletins USING btree (numero_categorie) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_inumeroParticipantUrne ON vote.bulletins USING btree (numero_participant) TABLESPACE vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroProduction01Urne ON vote.bulletins USING btree (numero_production01) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction02Urne ON vote.bulletins USING btree (numero_production02) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction03Urne ON vote.bulletins USING btree (numero_production03) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction04Urne ON vote.bulletins USING btree (numero_production04) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction05Urne ON vote.bulletins USING btree (numero_production05) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction06Urne ON vote.bulletins USING btree (numero_production06) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction07Urne ON vote.bulletins USING btree (numero_production07) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction08Urne ON vote.bulletins USING btree (numero_production08) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction09Urne ON vote.bulletins USING btree (numero_production09) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProduction10Urne ON vote.bulletins USING btree (numero_production10) TABLESPACE vote;

+ 27 - 0
postgresql/tables/categories.sql

@@ -0,0 +1,27 @@
+CREATE TABLE IF NOT EXISTS vote.categories
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_categorie integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    flag_actif boolean DEFAULT true,
+    libelle character varying(128) COLLATE pg_catalog."default" NOT NULL,
+    numero_ordre integer NOT NULL DEFAULT 1,
+    flag_upload boolean DEFAULT true,
+    flag_affiche boolean DEFAULT false,
+    flag_vote_ouvert boolean DEFAULT false,
+    flag_calcul boolean DEFAULT false,
+    nombre_votants integer DEFAULT 0,
+    flag_diaporama boolean DEFAULT false
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.categories OWNER to vote;
+
+CREATE FUNCTION vote.dateModificationCategorie() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationCategorie() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationCategorie BEFORE UPDATE ON vote.categories FOR EACH ROW EXECUTE FUNCTION vote.dateModificationCategorie();

+ 25 - 0
postgresql/tables/evenements.sql

@@ -0,0 +1,25 @@
+CREATE TABLE IF NOT EXISTS vote.evenements
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_evenement integer NOT NULL PRIMARY KEY,
+    libelle character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
+    lien character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
+    nom character varying(256) COLLATE pg_catalog."default" DEFAULT NULL,
+    numero_parent integer DEFAULT NULL,
+    numero_niveau integer DEFAULT NULL,
+    numero_ordre integer DEFAULT NULL,
+    script character varying(256) COLLATE pg_catalog."default" DEFAULT NULL
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.evenements OWNER to vote;
+
+CREATE FUNCTION vote.dateModificationEvenement() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationEvenement() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationEvenement BEFORE UPDATE ON vote.evenements FOR EACH ROW EXECUTE FUNCTION vote.dateModificationEvenement();

+ 15 - 0
postgresql/tables/messages.sql

@@ -0,0 +1,15 @@
+CREATE TABLE IF NOT EXISTS vote.messages
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    numero_message integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    numero_participant integer NOT NULL,
+    numero_destinataire integer,
+    ligne character varying(4000) COLLATE pg_catalog."default",
+    CONSTRAINT fk_numeroParticipantMessage FOREIGN KEY(numero_participant) REFERENCES vote.participants(numero_participant),
+    CONSTRAINT fk_numeroDestinataireMessage FOREIGN KEY(numero_destinataire) REFERENCES vote.participants(numero_participant)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.messages OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroParticipantMessage ON vote.messages USING btree (numero_participant) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroDestinataireMessage ON vote.messages USING btree (numero_destinataire) TABLESPACE vote;

+ 51 - 0
postgresql/tables/participants.sql

@@ -0,0 +1,51 @@
+CREATE TYPE vote.status_participant AS ENUM('En attente', 'Payé chèque', 'Payé espèces', 'Orga', 'Virement bancaire', 'Virement Paypal', 'Guest');
+CREATE TYPE vote.mode_paiement AS ENUM('Chèque', 'Virement', 'Paypal', 'Espèces', 'Autre');
+
+CREATE TABLE IF NOT EXISTS vote.participants
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_participant integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    flag_actif boolean DEFAULT true,
+    nom character varying(128) COLLATE pg_catalog."default" NOT NULL DEFAULT '',
+    prenom character varying(128) COLLATE pg_catalog."default" NOT NULL DEFAULT '',
+    pseudonyme character varying(128) COLLATE pg_catalog."default" NOT NULL DEFAULT '',
+    groupe character varying(128) COLLATE pg_catalog."default" NOT NULL DEFAULT '',
+    mot_de_passe character varying(256) COLLATE pg_catalog."default" NOT NULL DEFAULT '',
+    flag_expire boolean DEFAULT false,
+    date_expiration timestamp without time zone DEFAULT NULL,
+    delai_deconnexion integer NOT NULL DEFAULT 15,
+    adresse character varying(256) COLLATE pg_catalog."default" DEFAULT '',
+    code_postal character varying(16) COLLATE pg_catalog."default" DEFAULT '',
+    ville character varying(128) COLLATE pg_catalog."default" DEFAULT '',
+    pays character varying(128) COLLATE pg_catalog."default" DEFAULT 'France',
+    numero_telephone character varying(32) COLLATE pg_catalog."default" DEFAULT '',
+    email character varying(128) COLLATE pg_catalog."default" DEFAULT '',
+    status vote.status_participant DEFAULT 'En attente',
+    flag_machine boolean DEFAULT true,
+    commentaire text,
+    flag_jour1 boolean DEFAULT false,
+    flag_jour2 boolean DEFAULT false,
+    flag_jour3 boolean DEFAULT false,
+    flag_dodo_sur_place boolean DEFAULT true,
+    flag_amigabus boolean DEFAULT false,
+    mode_paiement vote.mode_paiement DEFAULT 'Chèque',
+    date_inscription timestamp without time zone NOT NULL DEFAULT now(),
+    somme_recue decimal(10,2) DEFAULT '0.00',
+    flag_arrive boolean DEFAULT false
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.participants OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_nomParticipant ON vote.participants USING btree (nom) TABLESPACE vote;
+CREATE UNIQUE INDEX IF NOT EXISTS ix_pseudonymeParticipant ON vote.participants USING btree (pseudonyme) TABLESPACE vote;
+
+CREATE FUNCTION vote.dateModificationParticipant() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationParticipant() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationParticipant BEFORE UPDATE ON vote.participants FOR EACH ROW EXECUTE FUNCTION vote.dateModificationParticipant();

+ 12 - 0
postgresql/tables/participants_roles.sql

@@ -0,0 +1,12 @@
+CREATE TABLE IF NOT EXISTS vote.participants_roles
+(
+    numero_participant integer NOT NULL,
+    numero_role integer NOT NULL,
+    CONSTRAINT fk_numeroParticpantRole FOREIGN KEY(numero_participant) REFERENCES vote.participants(numero_participant),
+    CONSTRAINT fk_numeroRoleParticipant FOREIGN KEY(numero_role) REFERENCES vote.roles(numero_role)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.participants_roles OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroParticpantRole ON vote.participants_roles USING btree (numero_participant) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroRoleParticipant ON vote.participants_roles USING btree (numero_role) TABLESPACE vote;

+ 24 - 0
postgresql/tables/preferences.sql

@@ -0,0 +1,24 @@
+CREATE TABLE IF NOT EXISTS vote.preferences
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_preference integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    numero_participant integer NOT NULL,
+    numero_traitement integer NOT NULL,
+    valeurs character varying(4000) COLLATE pg_catalog."default",
+    CONSTRAINT fk_numeroParticipantPreference FOREIGN KEY(numero_participant) REFERENCES vote.participants(numero_participant)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.preferences OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroParticipantPreference ON vote.preferences USING btree (numero_participant) TABLESPACE vote;
+
+CREATE FUNCTION vote.dateModificationPreference() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationPreference() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationPreference BEFORE UPDATE ON vote.preferences FOR EACH ROW EXECUTE FUNCTION vote.dateModificationPreference();

+ 16 - 0
postgresql/tables/presentations.sql

@@ -0,0 +1,16 @@
+CREATE TABLE IF NOT EXISTS vote.presentations
+(
+    numero_presentation integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    numero_categorie integer NOT NULL,
+    numero_production integer NOT NULL,
+    numero_ordre integer NOT NULL DEFAULT 0,
+    nombre_points integer NOT NULL DEFAULT 0,
+    nombre_pole_position integer NOT NULL DEFAULT 0,
+    CONSTRAINT fk_numeroCategoriePresentation FOREIGN KEY(numero_categorie) REFERENCES vote.categories(numero_categorie),
+    CONSTRAINT fk_numeroProductionPresentation FOREIGN KEY(numero_production) REFERENCES vote.productions(numero_production)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.presentations OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroCategoriePresentation ON vote.presentations USING btree (numero_categorie) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroProductionPresentation ON vote.presentations USING btree (numero_production) TABLESPACE vote;

+ 19 - 0
postgresql/tables/privileges.sql

@@ -0,0 +1,19 @@
+CREATE TABLE IF NOT EXISTS vote.privileges
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_privilege integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    libelle character varying(128) COLLATE pg_catalog."default" NOT NULL
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.privileges OWNER to vote;
+
+CREATE FUNCTION vote.dateModificationPrivilege() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationPrivilege() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationPrivilege BEFORE UPDATE ON vote.privileges FOR EACH ROW EXECUTE FUNCTION vote.dateModificationPrivilege();

+ 37 - 0
postgresql/tables/productions.sql

@@ -0,0 +1,37 @@
+CREATE TYPE vote.type_production AS ENUM('Exécutable', 'Graphe', 'Musique', 'Vidéo', 'Topic', 'Autre');
+
+CREATE TABLE IF NOT EXISTS vote.productions
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_production integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    flag_actif boolean DEFAULT true,
+    numero_participant integer NOT NULL,
+    adresse_ip inet NOT NULL,
+    type vote.type_production DEFAULT 'Autre',
+    titre character varying(256) COLLATE pg_catalog."default" NOT NULL DEFAULT 'unknown compo entry name',
+    auteurs character varying(256) COLLATE pg_catalog."default" NOT NULL DEFAULT 'unknown author(s)',
+    groupes character varying(256) COLLATE pg_catalog."default" NOT NULL DEFAULT 'unknown group(s)',
+    plateforme character varying(128) COLLATE pg_catalog."default" NULL DEFAULT '',
+    commentaire text,
+    informations_privees text,
+    nom_archive character varying(256) COLLATE pg_catalog."default" NOT NULL,
+    archive bytea,
+    vignette bytea,
+    numero_version integer DEFAULT 1,
+    CONSTRAINT fk_numeroParticipantProduction FOREIGN KEY(numero_participant) REFERENCES vote.participants(numero_participant)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.productions OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroParticipantProduction ON vote.productions USING btree (numero_participant) TABLESPACE vote;
+
+CREATE FUNCTION vote.dateModificationProduction() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationProduction() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationProduction BEFORE UPDATE ON vote.productions FOR EACH ROW EXECUTE FUNCTION vote.dateModificationProduction();

+ 20 - 0
postgresql/tables/roles.sql

@@ -0,0 +1,20 @@
+CREATE TABLE IF NOT EXISTS vote.roles
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_role integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    flag_actif boolean DEFAULT true,
+    libelle character varying(64) COLLATE pg_catalog."default" NOT NULL
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.roles OWNER to vote;
+
+CREATE FUNCTION vote.dateModificationRole() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationRole() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationRole BEFORE UPDATE ON vote.roles FOR EACH ROW EXECUTE FUNCTION vote.dateModificationRole();

+ 12 - 0
postgresql/tables/roles_privileges.sql

@@ -0,0 +1,12 @@
+CREATE TABLE IF NOT EXISTS vote.roles_privileges
+(
+    numero_privilege integer NOT NULL,
+    numero_role integer NOT NULL,
+    CONSTRAINT fk_numeroPrivilegeRole FOREIGN KEY(numero_privilege) REFERENCES vote.privileges(numero_privilege),
+    CONSTRAINT fk_numeroRolePrivilege FOREIGN KEY(numero_role) REFERENCES vote.roles(numero_role)
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.roles_privileges OWNER to vote;
+
+CREATE INDEX IF NOT EXISTS ix_numeroPrivilegeRole ON vote.roles_privileges USING btree (numero_privilege) TABLESPACE vote;
+CREATE INDEX IF NOT EXISTS ix_numeroRolePrivilege ON vote.roles_privileges USING btree (numero_role) TABLESPACE vote;

+ 22 - 0
postgresql/tables/variables.sql

@@ -0,0 +1,22 @@
+CREATE TABLE IF NOT EXISTS vote.variables
+(
+    date_creation timestamp without time zone NOT NULL DEFAULT now(),
+    date_modification timestamp without time zone,
+    numero_variable integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
+    type character varying(64) COLLATE pg_catalog."default" NOT NULL,
+    code character varying(64) COLLATE pg_catalog."default" NOT NULL,
+    valeur character varying(4000) COLLATE pg_catalog."default" NOT NULL,
+    notes character varying(4000) COLLATE pg_catalog."default"
+)
+TABLESPACE vote;
+ALTER TABLE IF EXISTS vote.variables OWNER to vote;
+
+CREATE FUNCTION vote.dateModificationVariable() RETURNS TRIGGER AS $$
+BEGIN
+  NEW.date_modification = now();
+  return NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+ALTER FUNCTION vote.dateModificationVariable() OWNER TO vote;
+
+CREATE OR REPLACE TRIGGER dateModificationVariable BEFORE UPDATE ON vote.variables FOR EACH ROW EXECUTE FUNCTION vote.dateModificationVariable();