Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/taxref2 migration #573

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions apptax/migrations/versions/633e0ad4c4e3_save_bib_nom_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@

def upgrade():
# Création d'une liste avec les cd_noms contenus dans bib_noms
# uniquement si la table bib_noms est peuplée (cas d'un upgrade)
op.execute(
"""
-- Création liste
INSERT INTO taxonomie.bib_listes (nom_liste, desc_liste, code_liste)
VALUES(
SELECT
'Save bib_noms',
'Liste contenant l''ensemble des cd_noms contenus historiquement dans la table bib_noms',
'BIB_NOMS'
);
FROM taxonomie.bib_noms AS bn
LIMIT 1;

-- Insertion des valeurs de bib_noms dans la liste
INSERT INTO taxonomie.cor_nom_liste (cd_nom, id_liste)
SELECT
Expand All @@ -42,7 +45,7 @@ def downgrade():
op.execute(
"""
DELETE FROM taxonomie.cor_nom_liste
WHERE id_liste = (SELECT id_liste FROM taxonomie.bib_listes WHERE code_liste ='BIB_NOM' LIMIT 1);
DELETE FROM taxonomie.bib_listes WHERE code_liste ='BIB_NOM';
WHERE id_liste = (SELECT id_liste FROM taxonomie.bib_listes WHERE code_liste ='BIB_NOMS' LIMIT 1);
DELETE FROM taxonomie.bib_listes WHERE code_liste ='BIB_NOMS';
"""
)
1 change: 0 additions & 1 deletion apptax/migrations/versions/83d7105edb76_taxref_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


def upgrade():
op.execute("CREATE EXTENSION IF NOT EXISTS ltree")
op.execute(
"""
CREATE MATERIALIZED VIEW taxonomie.vm_taxref_tree AS
Expand Down
Loading