From 4cf2accdd982b326c5999a0b7c2025e8cd303b7b Mon Sep 17 00:00:00 2001 From: jacquesfize Date: Thu, 19 Dec 2024 10:37:46 +0100 Subject: [PATCH 1/5] feat(media, source) : add alembic revision that increase the `t_medias.source` varchar size --- ...8a907f74c_increase_t_medias_source_size.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py diff --git a/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py b/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py new file mode 100644 index 00000000..4cab1811 --- /dev/null +++ b/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py @@ -0,0 +1,28 @@ +"""increase t_medias.source size + +Revision ID: 2c68a907f74c +Revises: 3c4762751898 +Create Date: 2024-12-19 10:31:05.778720 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '2c68a907f74c' +down_revision = '3c4762751898' +branch_labels = None +depends_on = None + + +def upgrade(): + op.alter_column('t_medias', 'source', + type_=sa.Unicode(), + existing_nullable=True,schema='taxonomie') + + +def downgrade(): + op.alter_column('t_medias', 'source', + type_=sa.VARCHAR(length=25), + existing_nullable=True,schema='taxonomie') From d4ffae61fe305c3bfc5386d8e08526cdb75874c9 Mon Sep 17 00:00:00 2001 From: jacquesfize Date: Thu, 19 Dec 2024 10:40:28 +0100 Subject: [PATCH 2/5] fix lint --- ...8a907f74c_increase_t_medias_source_size.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py b/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py index 4cab1811..be0e6f95 100644 --- a/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py +++ b/apptax/migrations/versions/2c68a907f74c_increase_t_medias_source_size.py @@ -5,24 +5,29 @@ Create Date: 2024-12-19 10:31:05.778720 """ + from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '2c68a907f74c' -down_revision = '3c4762751898' +revision = "2c68a907f74c" +down_revision = "3c4762751898" branch_labels = None depends_on = None def upgrade(): - op.alter_column('t_medias', 'source', - type_=sa.Unicode(), - existing_nullable=True,schema='taxonomie') + op.alter_column( + "t_medias", "source", type_=sa.Unicode(), existing_nullable=True, schema="taxonomie" + ) def downgrade(): - op.alter_column('t_medias', 'source', + op.alter_column( + "t_medias", + "source", type_=sa.VARCHAR(length=25), - existing_nullable=True,schema='taxonomie') + existing_nullable=True, + schema="taxonomie", + ) From 0b148772b41d748c1221d5dcd1243af5c6fd1902 Mon Sep 17 00:00:00 2001 From: jacquesfize Date: Fri, 20 Dec 2024 11:07:11 +0100 Subject: [PATCH 3/5] drop non-required db session.add --- apptax/tests/fixtures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/apptax/tests/fixtures.py b/apptax/tests/fixtures.py index aec6503f..f7fd46af 100644 --- a/apptax/tests/fixtures.py +++ b/apptax/tests/fixtures.py @@ -34,7 +34,6 @@ def noms_without_listexample(): with db.session.begin_nested(): for cd_nom, cd_ref, nom_francais, comments, attr in bibnom_exemple: nom = Taxref.query.get(cd_nom) - db.session.add(nom) noms.append(nom) return noms From 1a6fb0a70ad9174116ecdd4aaf20be65440668ba Mon Sep 17 00:00:00 2001 From: jacquesfize Date: Fri, 20 Dec 2024 11:19:32 +0100 Subject: [PATCH 4/5] wip --- apptax/taxonomie/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apptax/taxonomie/models.py b/apptax/taxonomie/models.py index d0b244d5..aaffafe4 100644 --- a/apptax/taxonomie/models.py +++ b/apptax/taxonomie/models.py @@ -174,7 +174,11 @@ class Taxref(db.Model): status = db.relationship("VBdcStatus", order_by="VBdcStatus.lb_type_statut") synonymes = db.relationship( - "Taxref", foreign_keys=[cd_ref], primaryjoin="Taxref.cd_ref == Taxref.cd_ref", uselist=True + "Taxref", + foreign_keys=[cd_ref], + primaryjoin="Taxref.cd_ref == Taxref.cd_ref", + uselist=True, + post_update=True, ) parent = db.relationship("Taxref", primaryjoin=foreign(cd_sup) == remote(cd_ref)) attributs = db.relationship("CorTaxonAttribut", back_populates="taxon") From 99a540386b1006d71b522e9644bca6f6f61012e9 Mon Sep 17 00:00:00 2001 From: jacquesfize Date: Fri, 20 Dec 2024 14:34:11 +0100 Subject: [PATCH 5/5] update changelog --- docs/changelog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 74af0243..9b4e4833 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,14 @@ # CHANGELOG + +2.1.1 (unreleased) +------------------ + +**🚀 Nouveautés** + +- La limite du nombre de caractères dans la colonne `source` des médias est levée (#595 par @jacquesfize,@amandine-sahl) + + 2.1.0 (2024-12-06) ------------------