Skip to content

Commit

Permalink
feat(media) : increase the t_medias.source varchar size + fix `Taxr…
Browse files Browse the repository at this point in the history
…ef.synonyms` relationship (#595)

* feat(media, source) : add alembic revision that increase the `t_medias.source` varchar size
* fix test backend
  • Loading branch information
jacquesfize authored Dec 20, 2024
1 parent e47fcd4 commit ab680d7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""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",
)
6 changes: 5 additions & 1 deletion apptax/taxonomie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion apptax/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down

0 comments on commit ab680d7

Please sign in to comment.