1
0
forked from ScoDoc/ScoDoc

Fix import dept (si minuscules dans le nom).

This commit is contained in:
Emmanuel Viennet 2021-08-20 09:57:38 +02:00
parent 2790951335
commit bfad156ac2
3 changed files with 9 additions and 6 deletions

View File

@ -222,10 +222,12 @@ def import_scodoc7_users(): # import-scodoc7-users
@app.cli.command() @app.cli.command()
@click.argument("dept") @click.argument("dept")
@click.argument("dept_db_name")
@with_appcontext @with_appcontext
def import_scodoc7_dept(dept): # import-scodoc7-dept def import_scodoc7_dept(dept: str, dept_db_name: str): # import-scodoc7-dept
"""Import département ScoDoc7""" """Import département ScoDoc 7: dept: InfoComm, dept_db_name: SCOINFOCOMM"""
tools.import_scodoc7_dept(dept) dept_db_uri = f"postgresql:///{dept_db_name}"
tools.import_scodoc7_dept(dept, dept_db_uri)
@app.cli.command() @app.cli.command()

View File

@ -421,5 +421,5 @@ SCO7_TABLES_ORDONNEES = [
""" """
from tools.import_scodoc7_dept import * from tools.import_scodoc7_dept import *
import_scodoc7_dept( "RT" ) import_scodoc7_dept( "RT", "SCORT" )
""" """

View File

@ -122,11 +122,12 @@ su -c "(cd $SCODOC_DIR && flask import-scodoc7-users)" "$SCODOC_USER"
for f in "$SCODOC_VAR_DIR"/config/depts/*.cfg for f in "$SCODOC_VAR_DIR"/config/depts/*.cfg
do do
dept=$(basename "${f%.*}") dept=$(basename "${f%.*}")
db_name=$(echo "SCO$dept" | tr "[:lower:]" "[:upper:]")
echo echo
echo "----------------------------------------------" echo "----------------------------------------------"
echo "| MIGRATION DU DEPARTEMENT $dept" echo "| MIGRATION DU DEPARTEMENT $dept"
echo "----------------------------------------------" echo "----------------------------------------------"
su -c "(cd $SCODOC_DIR && flask import-scodoc7-dept $dept)" "$SCODOC_USER" su -c "(cd $SCODOC_DIR && flask import-scodoc7-dept $dept $db_name)" "$SCODOC_USER"
echo "restarting postgresql server..." echo "restarting postgresql server..."
systemctl restart postgresql systemctl restart postgresql
done done