From 73920ec7c8e8fdf11fb7fc07eaf9b23ae861bf1b Mon Sep 17 00:00:00 2001 From: francois Date: Fri, 15 May 2020 00:49:45 -0400 Subject: [PATCH] =?UTF-8?q?changement=20programme=20entit=C3=A9s=20et=20co?= =?UTF-8?q?nversion=20cl=C3=A9s=20primaires=20=C3=A0=20SERIAL=20pour=20g?= =?UTF-8?q?=C3=A9rer=20l'incr=C3=A9mentation=20depuis=20python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Verifications.ipynb | 2 +- backup.sh | 2 +- entites.py | 15 +- etat_libre_entites.xmi | 1156 ++++++++--------- insertion_etatdulibre.ipynb | 679 ---------- questions_entite.py | 411 +++--- uml_generated_code/postgres/adresse.sql | 12 +- uml_generated_code/postgres/association.sql | 4 +- .../postgres/association_adresse.sql | 2 +- uml_generated_code/postgres/coordonnees.sql | 4 +- uml_generated_code/postgres/cours.sql | 4 +- uml_generated_code/postgres/etablissement.sql | 4 +- .../postgres/etablissement_adresse.sql | 2 +- uml_generated_code/postgres/evenement.sql | 2 +- uml_generated_code/postgres/licence.sql | 4 +- uml_generated_code/postgres/logo.sql | 4 +- uml_generated_code/postgres/personne.sql | 4 +- uml_generated_code/postgres/projet.sql | 4 +- 18 files changed, 820 insertions(+), 1495 deletions(-) delete mode 100644 insertion_etatdulibre.ipynb diff --git a/Verifications.ipynb b/Verifications.ipynb index ea9bf2e..695a3f3 100644 --- a/Verifications.ipynb +++ b/Verifications.ipynb @@ -126,7 +126,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.6" + "version": "3.7.7" } }, "nbformat": 4, diff --git a/backup.sh b/backup.sh index d08486c..ce07417 100644 --- a/backup.sh +++ b/backup.sh @@ -1,7 +1,7 @@ #!/bin/bash pg_dump --column-inserts \ --data-only \ ---file "backup_20200509" \ +--file "backup_20200515" \ --host "$PG_ETATLIBRE_IP" \ --port "5432" \ --username "etatdulibre" \ diff --git a/entites.py b/entites.py index f6ab595..fda85a8 100755 --- a/entites.py +++ b/entites.py @@ -8,7 +8,18 @@ Created on Sat May 9 09:53:25 2020 from questionary import prompt import questions_entite as qe +import dataset -entite = prompt(qe.choix_entite) +choix_entite = prompt(qe.choix_entite) +reponses = prompt(qe.questions_entite[choix_entite['type']]) -print(entite['entite']) +print("Choix:\n"+str(choix_entite)+"\nRéponse:\n"+str(reponses)) + +psql_string = 'postgresql://etatdulibre:etatdulibre@172.19.0.2/etatdulibre' + +try: + db = dataset.connect(psql_string) + table = db[choix_entite['type']] + table.insert(reponses) +except: + pass diff --git a/etat_libre_entites.xmi b/etat_libre_entites.xmi index bbac4cf..9b0d73f 100644 --- a/etat_libre_entites.xmi +++ b/etat_libre_entites.xmi @@ -1,71 +1,71 @@ - + umbrello uml modeller http://umbrello.kde.org 1.6.12 UnicodeUTF8 - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -73,604 +73,604 @@ - + - + - + - + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - - - - + + + + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -681,247 +681,247 @@ - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/insertion_etatdulibre.ipynb b/insertion_etatdulibre.ipynb deleted file mode 100644 index c0fbfb0..0000000 --- a/insertion_etatdulibre.ipynb +++ /dev/null @@ -1,679 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The sql extension is already loaded. To reload it, use:\n", - " %reload_ext sql\n" - ] - } - ], - "source": [ - "%load_ext sql\n", - "%config SqlMagic.autocommit=False # for engines that do not support autommit\n", - "%sql postgresql://etatdulibre:etatdulibre@172.23.0.2/etatdulibre" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# adresse" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.adresse(\n", - " adresse_id, numero_civique, type_rue, nom_rue, code_postal, ville, date_saisie)\n", - " VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING adresse_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# association" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.association(\n", - "\tassoc_id, logo_id, date_saisie, nom, sigle, type, description, date_fondation, date_fermeture)\n", - "\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING assoc_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# association_adresse" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.association_adresse(\n", - "\tassoc_id, adresse_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# association_coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.association_coordonnees(\n", - "\tassoc_id, coord_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# association_personne" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.association_personne(\n", - "\tassoc_id, pers_id, description)\n", - "\tVALUES (?, ?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n", - "1 rows affected.\n" - ] - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "%%sql\n", - "INSERT INTO public.coordonnees(\n", - "\tcoord_id, coord_type, coord_contenu)\n", - "\tVALUES (?, ?, ?) RETURNING coord_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# cours" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.cours(\n", - "\tcours_id, numero, nom, description)\n", - "\tVALUES (?, ?, ?, ?) RETURNING cours_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# cours_coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.cours_coordonnees(\n", - "\tcours_id, coord_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# cours_etablissement" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.cours_etablissement(\n", - "\tcours_id, etabl_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# cours_personne" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.cours_personne(\n", - "\tcours_id, pers_id, description)\n", - "\tVALUES (?, ?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# etablissement" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.etablissement(\n", - "\tetabl_id, nom)\n", - "\tVALUES (?, ?) RETURNING etabl_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# etablissement_adresse" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.etablissement_adresse(\n", - "\tetabl_id, adresse_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# etablissement_coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.etablissement_coordonnees(\n", - "\tetabl_id, coord_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# evenement" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.evenement(\n", - "\tevent_id, nom, date_debut, date_fin, est_recurrent, detail_recurrence, premiere_date, description)\n", - "\tVALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING event_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# evenement_association" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.evenement_association(\n", - "\tevent_id, assoc_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# evenement_coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.evenement_coordonnees(\n", - "\tcoord_id, event_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# evenement_etablissement" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.evenement_etablissement(\n", - "\tevent_id, etabl_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# evenement_personne" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.evenement_personne(\n", - "\tevent_id, pers_id, description)\n", - "\tVALUES (?, ?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# licence" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.licence(\n", - "\tlicence_id, nom, sigle)\n", - "\tVALUES (?, ?, ?) RETURNING licence_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# logo" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.logo(\n", - "\tlogo_id, logo_url)\n", - "\tVALUES (?, ?) RETURNING logo_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# personne" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n", - "1 rows affected.\n" - ] - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "%%sql\n", - "INSERT INTO public.personne(\n", - "\tpers_id, nom, prenom)\n", - "\tVALUES (?, ?, ?) RETURNING pers_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# personne_coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n", - "1 rows affected.\n" - ] - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "%%sql\n", - "INSERT INTO public.personne_coordonnees(\n", - "\tcoord_id, pers_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# projet" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n", - "1 rows affected.\n" - ] - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "%%sql\n", - "INSERT INTO public.projet(\n", - "\tprojet_id, nom, description)\n", - "\tVALUES (?, ?, ?) RETURNING projet_id;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# projet_association" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.projet_association(\n", - "\tprojet_id, assoc_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# projet_coordonnees" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n", - "1 rows affected.\n" - ] - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "%%sql\n", - "INSERT INTO public.projet_coordonnees(\n", - "\tprojet_id, coord_id)\n", - "\tVALUES (1, 2);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# projet_licence" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "INSERT INTO public.projet_licence(\n", - "\tprojet_id, licence_id)\n", - "\tVALUES (?, ?);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# projet_personne" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n", - "1 rows affected.\n" - ] - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "%%sql\n", - "INSERT INTO public.projet_personne(\n", - "\tprojet_id, pers_id, description)\n", - "\tVALUES (?, ?, ?);" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/questions_entite.py b/questions_entite.py index 57acf44..21cf921 100755 --- a/questions_entite.py +++ b/questions_entite.py @@ -9,7 +9,7 @@ Created on Sat May 9 23:18:09 2020 choix_entite = [ { 'type': 'list', - 'name': 'entite', + 'name': 'type', 'message': 'entite', 'choices': [ 'adresse', @@ -26,211 +26,204 @@ choix_entite = [ } ] -questions_adresse = [ - { - 'type': 'input', - 'name': 'numero_civique', - 'message': 'numero_civique' - }, - { - 'type': 'list', - 'name': 'type_rue', - 'message': 'type_rue', - 'choices': [ - 'rue', - 'avenue', - 'boulevard', - 'chemin' - 'route' - '' - ] - }, - { - 'type': 'input', - 'name': 'nom_rue', - 'message': 'nom_rue' - }, - { - 'type': 'input', - 'name': 'code_postal', - 'message': 'code_postal' - }, - { - 'type': 'input', - 'name': 'ville', - 'message': 'ville' - } - ] - -questions_association = [ - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - }, - { - 'type': 'input', - 'name': 'sigle', - 'message': 'sigle' - }, - { - 'type': 'list', - 'name': 'type', - 'message': 'type', - 'choices': [ - 'groupe d\'utilisateurs', - 'groupe de développeurs', - 'réseautage et évenementiel', - 'atelier ou fablab', - 'formation', - 'bienfaisance', - 'autre' - ] - }, - { - 'type': 'editor', - 'name': 'description', - 'message': 'description' - }, - { - 'type': 'input', - 'name': 'date_fondation', - 'message': 'date_fondation' - }, - { - 'type': 'input', - 'name': 'date_fermeture', - 'message': 'date_fermeture' - } - ] - -questions_coordonnees = [ - { - 'type': 'list', - 'name': 'coord_type', - 'message': 'coord_type', - 'choices': [ - 'url', - 'courriel', - 'telephone', - 'fax' - ] - }, - { - 'type': 'input', - 'name': 'coord_contenu', - 'message': 'coord_contenu' - } - ] - -questions_cours = [ - { - 'type': 'input', - 'name': 'numero', - 'message': 'numero' - }, - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - }, - { - 'type': 'editor', - 'name': 'description', - 'message': 'description' - } - ] - -questions_etablissement = [ - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - } - ] - -questions_evenement = [ - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - }, - { - 'type': 'input', - 'name': 'date_debut', - 'message': 'date_debut' - }, - { - 'type': 'input', - 'name': 'date_fin', - 'message': 'date_fin' - }, - { - 'type': 'list', - 'name': 'est_recurrent', - 'message': 'est_recurrent', - 'choices': ['O', 'N'] - }, - { - 'type': 'input', - 'name': 'detail_recurrence', - 'message': 'detail_recurrence' - }, - { - 'type': 'input', - 'name': 'premiere_date', - 'message': 'premiere_date' - }, - { - 'type': 'editor', - 'name': 'description', - 'message': 'description' - } - ] - -questions_licence = [ - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - }, - { - 'type': 'input', - 'name': 'sigle', - 'message': 'sigle' - } - ] - -questions_logo = [ - { - 'type': 'input', - 'name': 'logo_url', - 'message': 'logo_url' - } - ] - -questions_personne = [ - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - }, - { - 'type': 'input', - 'name': 'prénom', - 'message': 'prénom' - } - ] - -questions_projet = [ - { - 'type': 'input', - 'name': 'nom', - 'message': 'nom' - }, - { - 'type': 'editor', - 'name': 'description', - 'message': 'description' - } - ] +questions_entite = { + 'adresse': [ + { + 'type': 'input', + 'name': 'numero_civique', + 'message': 'numero_civique' + }, + { + 'type': 'list', + 'name': 'type_rue', + 'message': 'type_rue', + 'choices': [ + 'rue', + 'avenue', + 'boulevard', + 'chemin' + 'route' + '' + ] + }, + { + 'type': 'input', + 'name': 'nom_rue', + 'message': 'nom_rue' + }, + { + 'type': 'input', + 'name': 'code_postal', + 'message': 'code_postal' + }, + { + 'type': 'input', + 'name': 'ville', + 'message': 'ville' + } + ], + 'association': [ + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + }, + { + 'type': 'input', + 'name': 'sigle', + 'message': 'sigle' + }, + { + 'type': 'list', + 'name': 'type', + 'message': 'type', + 'choices': [ + 'groupe d\'utilisateurs', + 'groupe de développeurs', + 'réseautage et évenementiel', + 'atelier ou fablab', + 'formation', + 'bienfaisance', + 'autre' + ] + }, + { + 'type': 'editor', + 'name': 'description', + 'message': 'description' + }, + { + 'type': 'input', + 'name': 'date_fondation', + 'message': 'date_fondation' + }, + { + 'type': 'input', + 'name': 'date_fermeture', + 'message': 'date_fermeture' + } + ], + 'coordonnees': [ + { + 'type': 'list', + 'name': 'coord_type', + 'message': 'coord_type', + 'choices': [ + 'url', + 'courriel', + 'telephone', + 'fax' + ] + }, + { + 'type': 'input', + 'name': 'coord_contenu', + 'message': 'coord_contenu' + } + ], + 'cours': [ + { + 'type': 'input', + 'name': 'numero', + 'message': 'numero' + }, + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + }, + { + 'type': 'editor', + 'name': 'description', + 'message': 'description' + } + ], + 'etablissement': [ + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + } + ], + 'evenement': [ + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + }, + { + 'type': 'input', + 'name': 'date_debut', + 'message': 'date_debut' + }, + { + 'type': 'input', + 'name': 'date_fin', + 'message': 'date_fin' + }, + { + 'type': 'list', + 'name': 'est_recurrent', + 'message': 'est_recurrent', + 'choices': ['O', 'N'] + }, + { + 'type': 'input', + 'name': 'detail_recurrence', + 'message': 'detail_recurrence' + }, + { + 'type': 'input', + 'name': 'premiere_date', + 'message': 'premiere_date' + }, + { + 'type': 'editor', + 'name': 'description', + 'message': 'description' + } + ], + 'licence': [ + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + }, + { + 'type': 'input', + 'name': 'sigle', + 'message': 'sigle' + } + ], + 'logo': [ + { + 'type': 'input', + 'name': 'logo_url', + 'message': 'logo_url' + } + ], + 'personne': [ + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + }, + { + 'type': 'input', + 'name': 'prenom', + 'message': 'prenom' + } + ], + 'projet': [ + { + 'type': 'input', + 'name': 'nom', + 'message': 'nom' + }, + { + 'type': 'editor', + 'name': 'description', + 'message': 'description' + } + ] + } diff --git a/uml_generated_code/postgres/adresse.sql b/uml_generated_code/postgres/adresse.sql index 5a1b683..445cc30 100644 --- a/uml_generated_code/postgres/adresse.sql +++ b/uml_generated_code/postgres/adresse.sql @@ -5,7 +5,7 @@ -- CREATE TABLE adresse ( - adresse_id integer NOT NULL , + serial integer NOT NULL , numero_civique character varying NOT NULL , type_rue character varying NOT NULL , nom_rue character varying NOT NULL , @@ -13,11 +13,11 @@ CREATE TABLE adresse ( ville character varying NOT NULL , date_saisie date NOT NULL ); -CREATE SEQUENCE adresse_adresse_id_seq START 1 INCREMENT 1 ; -ALTER TABLE adresse ALTER COLUMN adresse_id SET NOT 0; -ALTER TABLE adresse ALTER COLUMN adresse_id SET DEFAULT nextval('adresse_adresse_id_seq'); +CREATE SEQUENCE adresse_serial_seq START 1 INCREMENT 1 ; +ALTER TABLE adresse ALTER COLUMN serial SET NOT NULL; +ALTER TABLE adresse ALTER COLUMN serial SET DEFAULT nextval('adresse_serial_seq'); -- -ALTER TABLE adresse ADD CONSTRAINT primaire_adresse_id PRIMARY KEY (adresse_id); +ALTER TABLE adresse ADD CONSTRAINT primaire_adresse_id PRIMARY KEY (serial); -CREATE INDEX adresse_adresse_id_index ON adresse(adresse_id); +CREATE INDEX adresse_serial_index ON adresse(serial); diff --git a/uml_generated_code/postgres/association.sql b/uml_generated_code/postgres/association.sql index 271f848..49777f0 100644 --- a/uml_generated_code/postgres/association.sql +++ b/uml_generated_code/postgres/association.sql @@ -5,7 +5,7 @@ -- CREATE TABLE association ( - assoc_id integer NOT NULL , + assoc_id serial NOT NULL , date_saisie date NOT NULL , nom character varying NOT NULL , sigle character varying, @@ -15,7 +15,7 @@ CREATE TABLE association ( date_fermeture date ); CREATE SEQUENCE association_assoc_id_seq START 1 INCREMENT 1 ; -ALTER TABLE association ALTER COLUMN assoc_id SET NOT 0; +ALTER TABLE association ALTER COLUMN assoc_id SET NOT NULL; ALTER TABLE association ALTER COLUMN assoc_id SET DEFAULT nextval('association_assoc_id_seq'); -- diff --git a/uml_generated_code/postgres/association_adresse.sql b/uml_generated_code/postgres/association_adresse.sql index 3b1eb51..658baae 100644 --- a/uml_generated_code/postgres/association_adresse.sql +++ b/uml_generated_code/postgres/association_adresse.sql @@ -10,7 +10,7 @@ CREATE TABLE association_adresse ( ); -- -ALTER TABLE association_adresse ADD CONSTRAINT association_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(adresse_id) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE association_adresse ADD CONSTRAINT association_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(serial) ON UPDATE CASCADE ON DELETE CASCADE; -- ALTER TABLE association_adresse ADD CONSTRAINT nouvelle_contrainte_clé_étrangère FOREIGN KEY (assoc_id) REFERENCES association(assoc_id) ON UPDATE CASCADE ON DELETE CASCADE; diff --git a/uml_generated_code/postgres/coordonnees.sql b/uml_generated_code/postgres/coordonnees.sql index a9843ba..ac5fe67 100644 --- a/uml_generated_code/postgres/coordonnees.sql +++ b/uml_generated_code/postgres/coordonnees.sql @@ -5,12 +5,12 @@ -- CREATE TABLE coordonnees ( - coord_id integer NOT NULL , + coord_id serial NOT NULL , coord_type character varying NOT NULL , coord_contenu character varying ); CREATE SEQUENCE coordonnees_coord_id_seq START 1 INCREMENT 1 ; -ALTER TABLE coordonnees ALTER COLUMN coord_id SET NOT 0; +ALTER TABLE coordonnees ALTER COLUMN coord_id SET NOT NULL; ALTER TABLE coordonnees ALTER COLUMN coord_id SET DEFAULT nextval('coordonnees_coord_id_seq'); -- diff --git a/uml_generated_code/postgres/cours.sql b/uml_generated_code/postgres/cours.sql index f60d54e..7c4d99b 100644 --- a/uml_generated_code/postgres/cours.sql +++ b/uml_generated_code/postgres/cours.sql @@ -5,13 +5,13 @@ -- CREATE TABLE cours ( - cours_id integer NOT NULL , + cours_id serial NOT NULL , numero character varying, nom character varying, description character varying ); CREATE SEQUENCE cours_cours_id_seq START 1 INCREMENT 1 ; -ALTER TABLE cours ALTER COLUMN cours_id SET NOT 0; +ALTER TABLE cours ALTER COLUMN cours_id SET NOT NULL; ALTER TABLE cours ALTER COLUMN cours_id SET DEFAULT nextval('cours_cours_id_seq'); -- diff --git a/uml_generated_code/postgres/etablissement.sql b/uml_generated_code/postgres/etablissement.sql index 8b0b0a8..a585165 100644 --- a/uml_generated_code/postgres/etablissement.sql +++ b/uml_generated_code/postgres/etablissement.sql @@ -5,11 +5,11 @@ -- CREATE TABLE etablissement ( - etabl_id integer NOT NULL , + etabl_id serial NOT NULL , nom character varying ); CREATE SEQUENCE etablissement_etabl_id_seq START 1 INCREMENT 1 ; -ALTER TABLE etablissement ALTER COLUMN etabl_id SET NOT 0; +ALTER TABLE etablissement ALTER COLUMN etabl_id SET NOT NULL; ALTER TABLE etablissement ALTER COLUMN etabl_id SET DEFAULT nextval('etablissement_etabl_id_seq'); -- diff --git a/uml_generated_code/postgres/etablissement_adresse.sql b/uml_generated_code/postgres/etablissement_adresse.sql index 56d0cfb..496e9a7 100644 --- a/uml_generated_code/postgres/etablissement_adresse.sql +++ b/uml_generated_code/postgres/etablissement_adresse.sql @@ -13,7 +13,7 @@ CREATE TABLE etablissement_adresse ( ALTER TABLE etablissement_adresse ADD CONSTRAINT etablissement_adresse_etablissement FOREIGN KEY (etabl_id) REFERENCES etablissement(etabl_id) ON UPDATE CASCADE ON DELETE CASCADE; -- -ALTER TABLE etablissement_adresse ADD CONSTRAINT etablissement_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(adresse_id) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE etablissement_adresse ADD CONSTRAINT etablissement_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(serial) ON UPDATE CASCADE ON DELETE CASCADE; CREATE INDEX etablissement_adresse_etabl_id_index ON etablissement_adresse(etabl_id); diff --git a/uml_generated_code/postgres/evenement.sql b/uml_generated_code/postgres/evenement.sql index 7b33eb0..d405839 100644 --- a/uml_generated_code/postgres/evenement.sql +++ b/uml_generated_code/postgres/evenement.sql @@ -15,7 +15,7 @@ CREATE TABLE evenement ( description character varying ); CREATE SEQUENCE evenement_event_id_seq START 1 INCREMENT 1 ; -ALTER TABLE evenement ALTER COLUMN event_id SET NOT 0; +ALTER TABLE evenement ALTER COLUMN event_id SET NOT NULL; ALTER TABLE evenement ALTER COLUMN event_id SET DEFAULT nextval('evenement_event_id_seq'); -- diff --git a/uml_generated_code/postgres/licence.sql b/uml_generated_code/postgres/licence.sql index fb95d16..8efc3ba 100644 --- a/uml_generated_code/postgres/licence.sql +++ b/uml_generated_code/postgres/licence.sql @@ -5,12 +5,12 @@ -- CREATE TABLE licence ( - licence_id integer NOT NULL , + licence_id serial NOT NULL , nom character varying NOT NULL , sigle character varying ); CREATE SEQUENCE licence_licence_id_seq START 1 INCREMENT 1 ; -ALTER TABLE licence ALTER COLUMN licence_id SET NOT 0; +ALTER TABLE licence ALTER COLUMN licence_id SET NOT NULL; ALTER TABLE licence ALTER COLUMN licence_id SET DEFAULT nextval('licence_licence_id_seq'); -- diff --git a/uml_generated_code/postgres/logo.sql b/uml_generated_code/postgres/logo.sql index 53e9e39..0d68429 100644 --- a/uml_generated_code/postgres/logo.sql +++ b/uml_generated_code/postgres/logo.sql @@ -5,11 +5,11 @@ -- CREATE TABLE logo ( - logo_id integer NOT NULL , + logo_id serial NOT NULL , logo_url character varying ); CREATE SEQUENCE logo_logo_id_seq START 1 INCREMENT 1 ; -ALTER TABLE logo ALTER COLUMN logo_id SET NOT 0; +ALTER TABLE logo ALTER COLUMN logo_id SET NOT NULL; ALTER TABLE logo ALTER COLUMN logo_id SET DEFAULT nextval('logo_logo_id_seq'); -- diff --git a/uml_generated_code/postgres/personne.sql b/uml_generated_code/postgres/personne.sql index 8ac6e0e..27b5e74 100644 --- a/uml_generated_code/postgres/personne.sql +++ b/uml_generated_code/postgres/personne.sql @@ -5,12 +5,12 @@ -- CREATE TABLE personne ( - pers_id integer NOT NULL , + pers_id serial NOT NULL , nom character varying, prenom character varying ); CREATE SEQUENCE personne_pers_id_seq START 1 INCREMENT 1 ; -ALTER TABLE personne ALTER COLUMN pers_id SET NOT 0; +ALTER TABLE personne ALTER COLUMN pers_id SET NOT NULL; ALTER TABLE personne ALTER COLUMN pers_id SET DEFAULT nextval('personne_pers_id_seq'); -- diff --git a/uml_generated_code/postgres/projet.sql b/uml_generated_code/postgres/projet.sql index 4407eb0..7a9e38f 100644 --- a/uml_generated_code/postgres/projet.sql +++ b/uml_generated_code/postgres/projet.sql @@ -5,12 +5,12 @@ -- CREATE TABLE projet ( - projet_id integer NOT NULL , + projet_id serial NOT NULL , nom character varying NOT NULL , description character varying ); CREATE SEQUENCE projet_projet_id_seq START 1 INCREMENT 1 ; -ALTER TABLE projet ALTER COLUMN projet_id SET NOT 0; +ALTER TABLE projet ALTER COLUMN projet_id SET NOT NULL; ALTER TABLE projet ALTER COLUMN projet_id SET DEFAULT nextval('projet_projet_id_seq'); --