From 13da746690d252cb86e781166052ef69029ee83e Mon Sep 17 00:00:00 2001 From: dbernstein Date: Fri, 20 Dec 2024 09:49:34 -0800 Subject: [PATCH] Increase circulationevents.type field length to 50 (from 32) to aaccomodate new event types. (#2221) --- ..._increase_circulation_event_type_field_.py | 28 +++++++++++++++++++ .../sqlalchemy/model/circulationevent.py | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/20241220_579786fecbf4_increase_circulation_event_type_field_.py diff --git a/alembic/versions/20241220_579786fecbf4_increase_circulation_event_type_field_.py b/alembic/versions/20241220_579786fecbf4_increase_circulation_event_type_field_.py new file mode 100644 index 000000000..0bd334bad --- /dev/null +++ b/alembic/versions/20241220_579786fecbf4_increase_circulation_event_type_field_.py @@ -0,0 +1,28 @@ +"""Increase circulation event type field length + +Revision ID: 579786fecbf4 +Revises: 603b8ebd6daf +Create Date: 2024-12-20 06:30:30.148748+00:00 + +""" + +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "579786fecbf4" +down_revision = "603b8ebd6daf" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.alter_column( + "circulationevents", "type", existing_type=sa.VARCHAR(32), type_=sa.VARCHAR(50) + ) + + +def downgrade() -> None: + op.alter_column( + "circulationevents", "type", existing_type=sa.VARCHAR(50), type_=sa.VARCHAR(32) + ) diff --git a/src/palace/manager/sqlalchemy/model/circulationevent.py b/src/palace/manager/sqlalchemy/model/circulationevent.py index c2c1c33f9..8de41658d 100644 --- a/src/palace/manager/sqlalchemy/model/circulationevent.py +++ b/src/palace/manager/sqlalchemy/model/circulationevent.py @@ -35,7 +35,7 @@ class CirculationEvent(Base): "LicensePool", back_populates="circulation_events" ) - type = Column(String(32), index=True) + type = Column(String(50), index=True) start = Column(DateTime(timezone=True), index=True) end = Column(DateTime(timezone=True)) old_value = Column(Integer)