modifications mineures

This commit is contained in:
francois 2020-05-16 22:16:41 -04:00
parent a389f59473
commit a7c8bb0328
16 changed files with 595 additions and 590 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.ipynb_checkpoints/
.spyproject/
__pycache__/
backup_*

View file

@ -1,8 +1,8 @@
#!/bin/bash
pg_dump --column-inserts \
--data-only \
--file "backup_20200515" \
--host "$PG_ETATLIBRE_IP" \
--file "backup_$(date --iso-8601)" \
--host 0.0.0.0 \
--port "5432" \
--username "etatdulibre" \
--blobs "etatdulibre"

View file

@ -11,24 +11,22 @@ import choix_entite as ce
import questions_entite as qe
import questions_relations as qr
import dataset
import pprint
def saisie_entite():
choix_entite = qq.prompt(ce.choix_entite('entite', 'entite'))['entite']
pp.pprint(choix_entite)
reponses = qq.prompt(qe.questions_entite[choix_entite])
pp.pprint(reponses)
try:
table = db[choix_entite]
table.insert(reponses)
for i in table.find(**reponses):
print(i)
except Exception as e:
print("Erreur dans l'insertion:"+str(e))
def saisie_relation():
reponses = qq.prompt(qr.questions_relations)
pp.pprint("Réponse:\n"+str(reponses))
try:
table = db[reponses['entite1']+"_"+reponses['entite2']]
nom1 = db[reponses['entite1']].columns[0]
@ -37,13 +35,14 @@ def saisie_relation():
nom2: reponses['id_entite2'],
'description': reponses['description']}
table.insert(reponses_insert)
for i in table.find(**reponses_insert):
print(i)
except Exception as e:
print("Erreur dans l'insertion:"+str(e))
psql_string = 'postgresql://etatdulibre:etatdulibre@172.20.0.2/etatdulibre'
psql_string = 'postgresql://etatdulibre:etatdulibre@0.0.0.0/etatdulibre'
db = dataset.connect(psql_string)
pp = pprint.PrettyPrinter(indent=4)
quitter = 0
while quitter == 0:

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,19 @@
fix:
bash fix_sql.sh
build:
docker network create librenet
bash fix_sql.sh
docker build --tag=etatdulibre .
docker run --name=etatdulibre --mount source=el_pgdata,target=/var/lib/postgresql/data --network=librenet -it -p 5432:5432 -p 2222:22 etatdulibre
docker run --name=pgadminlibre --network=librenet -p 80:80 -e 'PGADMIN_DEFAULT_EMAIL=etatdulibre@librenet' -e 'PGADMIN_DEFAULT_PASSWORD=etatdulibre' -e 'PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION=True' -e 'PGADMIN_CONFIG_LOGIN_BANNER="Authorised users only!"' -e 'PGADMIN_CONFIG_CONSOLE_LOG_LEVEL=10' -d dpage/pgadmin4
run:
docker start etatdulibre
docker run --name=pgadminlibre --network=librenet -p 80:80 -e 'PGADMIN_DEFAULT_EMAIL=etatdulibre@librenet' -e 'PGADMIN_DEFAULT_PASSWORD=etatdulibre' -e 'PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION=True' -e 'PGADMIN_CONFIG_LOGIN_BANNER="Authorised users only!"' -e 'PGADMIN_CONFIG_CONSOLE_LOG_LEVEL=10' -d dpage/pgadmin4
docker start pgadminlibre
stop:
-bash backup.sh
-docker stop etatdulibre
-docker stop pgadminlibre
clean:
-docker stop etatdulibre pgadminlibre
-docker container rm etatdulibre pgadminlibre
-docker image rm etatdulibre pgadminlibre
-docker network rm librenet

View file

@ -145,7 +145,7 @@ questions_entite = {
'type': 'list',
'name': 'est_recurrent',
'message': 'est_recurrent',
'choices': ['O', 'N']
'choices': ['oui', 'non']
},
{
'type': 'input',

View file

@ -14,7 +14,7 @@ CREATE TABLE adresse (
date_saisie date NOT NULL
);
CREATE SEQUENCE adresse_serial_seq START 1 INCREMENT 1 ;
ALTER TABLE adresse ALTER COLUMN serial SET NOT 0;
ALTER TABLE adresse ALTER COLUMN serial SET NOT NULL;
ALTER TABLE adresse ALTER COLUMN serial SET DEFAULT nextval('adresse_serial_seq');
--

View file

@ -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');
--

View file

@ -10,7 +10,7 @@ CREATE TABLE coordonnees (
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');
--

View file

@ -11,7 +11,7 @@ CREATE TABLE cours (
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');
--

View file

@ -9,7 +9,7 @@ CREATE TABLE etablissement (
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');
--

View file

@ -9,13 +9,13 @@ CREATE TABLE evenement (
nom character varying NOT NULL ,
date_debut date NOT NULL ,
date_fin date NOT NULL ,
est_recurrent integer NOT NULL DEFAULT 0,
est_recurrent character varying NOT NULL ,
detail_recurrence character varying,
premiere_date date,
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');
--

View file

@ -10,7 +10,7 @@ CREATE TABLE licence (
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');
--

View file

@ -9,7 +9,7 @@ CREATE TABLE logo (
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');
--

View file

@ -10,7 +10,7 @@ CREATE TABLE personne (
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');
--

View file

@ -10,7 +10,7 @@ CREATE TABLE projet (
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');
--