From cc689318cfe90dd00f0ab8607a4f377587bbd602 Mon Sep 17 00:00:00 2001 From: Pierre Narcisi Date: Wed, 20 Mar 2024 11:43:49 +0100 Subject: [PATCH] Feat(import) add mapping_condition --- backend/geonature/core/imports/models.py | 1 + ...4d586_add_required_conditions_in_import.py | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py diff --git a/backend/geonature/core/imports/models.py b/backend/geonature/core/imports/models.py index ad3d6b49a4..fae257e7e7 100644 --- a/backend/geonature/core/imports/models.py +++ b/backend/geonature/core/imports/models.py @@ -410,6 +410,7 @@ class BibFields(db.Model): nomenclature_type = relationship("BibNomenclaturesTypes") display = db.Column(db.Boolean, nullable=False) multi = db.Column(db.Boolean) + mapping_condition = db.Column(db.Unicode, nullable=True) entities = relationship("EntityField", back_populates="field") diff --git a/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py b/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py new file mode 100644 index 0000000000..7fc7ab2dbf --- /dev/null +++ b/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py @@ -0,0 +1,31 @@ +"""add required conditions in import + +Revision ID: 8b149244d586 +Revises: fe3d0b49ee14 +Create Date: 2024-03-20 11:17:57.360785 + +""" + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "8b149244d586" +down_revision = "fe3d0b49ee14" +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column( + table_name="bib_fields", + schema="gn_imports", + column=sa.Column("mapping_condition", sa.String()), + ) + pass + + +def downgrade(): + op.drop_column(table_name="bib_fields", schema="gn_imports", column_name="mapping_condition") + pass