Skip to content

Commit

Permalink
feat(occhab, mosaiqueNomenclature) : debug revision and change head
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Jul 18, 2024
1 parent e827fbe commit 2125bb5
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from alembic import op
from pypnnomenclature.models import BibNomenclaturesTypes, TNomenclatures
import sqlalchemy as sa
from sqlalchemy.orm.session import Session


# revision identifiers, used by Alembic.
revision = "5e882af04ff6"
down_revision = "b820c66d8daa"
down_revision = "ee1146f6c0f4"
branch_labels = None
depends_on = None

Expand Down Expand Up @@ -96,8 +97,15 @@ def upgrade():


def downgrade():
session = Session(bind=op.get_bind())
id_nomenclature_type = session.scalar(
sa.select(sa.func.ref_nomenclatures.get_id_nomenclature_type("MOSAIQUE_HAB"))
)
session.close()
op.execute(
sa.delete(TNomenclatures).where(TNomenclatures.mnemonique == "MOSAIQUE_HAB"),
sa.delete(TNomenclatures).where(
TNomenclatures.id_type == id_nomenclature_type,
),
)
op.execute(
sa.delete(BibNomenclaturesTypes).where(BibNomenclaturesTypes.mnemonique == "MOSAIQUE_HAB")
Expand Down

0 comments on commit 2125bb5

Please sign in to comment.