forked from ScoDoc/ScoDoc
Fix migration script: delete etuds with dept=NULL;
This commit is contained in:
parent
2c8c1f7ae2
commit
9bc0111ceb
@ -45,13 +45,27 @@ def upgrade():
|
||||
)
|
||||
# Affecte arbitrairement les éventuels étudiants sans département au 1er
|
||||
# (il ne devrait pas y en avoir, sauf essais manuels ou bugs)
|
||||
# nb_etuds_sans_dept = session.execute(
|
||||
# sa.text("""select count(*) from identite where dept_id is NULL;""")
|
||||
# )
|
||||
# if nb_etuds_sans_dept:
|
||||
# session.execute(
|
||||
# sa.text(
|
||||
# """
|
||||
# INSERT INTO departement (acronym, description, visible)
|
||||
# VALUES ('SANS_DEPT', 'interne: rattache objets sans departement', false);
|
||||
# UPDATE identite SET code_ine = NULL WHERE dept_id IS NULL;
|
||||
# UPDATE identite SET code_nip = NULL WHERE dept_id IS NULL;
|
||||
# UPDATE identite SET dept_id = (
|
||||
# SELECT id from departement where acronym = 'SANS_DEPT'
|
||||
# ) WHERE dept_id IS NULL;
|
||||
# """
|
||||
# )
|
||||
# )
|
||||
session.execute(
|
||||
sa.text(
|
||||
"""
|
||||
UPDATE identite SET dept_id = (
|
||||
SELECT MIN(id)
|
||||
FROM departement
|
||||
) WHERE dept_id IS NULL;
|
||||
DELETE FROM identite WHERE dept_id IS NULL;
|
||||
"""
|
||||
)
|
||||
)
|
||||
@ -114,7 +128,7 @@ def upgrade():
|
||||
session.execute(
|
||||
sa.text(
|
||||
"""
|
||||
UPDATE identite SET admission_id = admissions.id
|
||||
UPDATE identite SET admission_id = admissions.id
|
||||
FROM admissions WHERE admissions.etudid = identite.id;
|
||||
"""
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.46"
|
||||
SCOVERSION = "9.6.47"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
@ -96,7 +96,7 @@ mkdir -p "$optdir" || die "mkdir failure for $optdir"
|
||||
archive="$FACTORY_DIR"/"$PACKAGE_NAME-$RELEASE_TAG".tar.gz
|
||||
echo "Downloading $GIT_RELEASE_URL ..."
|
||||
# curl -o "$archive" "$GIT_RELEASE_URL" || die "curl failure for $GIT_RELEASE_URL"
|
||||
wget --progress=dot -O "$archive" "$GIT_RELEASE_URL" || die "wget failure for $GIT_RELEASE_URL"
|
||||
#wget --progress=dot -O "$archive" "$GIT_RELEASE_URL" || die "wget failure for $GIT_RELEASE_URL"
|
||||
# -nv
|
||||
|
||||
# On décomprime
|
||||
@ -129,7 +129,7 @@ cp -p "$SCODOC_DIR"/tools/etc/scodoc9.service "$slash"/etc/systemd/system/ || di
|
||||
|
||||
# Répertoire DEBIAN
|
||||
mv "$SCODOC_DIR"/tools/debian "$slash"/DEBIAN || die "can't install DEBIAN dir"
|
||||
chmod 750 "$slash"/DEBIAN/*inst || die "can't chmod debian scripts"
|
||||
chmod 775 "$slash"/DEBIAN/*inst || die "can't chmod debian scripts"
|
||||
|
||||
# ------------ CREATION DU VIRTUALENV
|
||||
#echo "Creating python3 virtualenv..."
|
||||
|
Loading…
Reference in New Issue
Block a user