fix(module-builder): widen category, disease, and pattern code columns to VARCHAR(128) #32
|
|
@ -154,6 +154,14 @@ def upgrade() -> None:
|
||||||
onupdate="CASCADE",
|
onupdate="CASCADE",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Expand code columns to 256 characters to safely handle long clinical pattern codes
|
||||||
|
op.alter_column("builder_categories", "category_code", type_=sa.String(256), schema=CONTENT_SCHEMA)
|
||||||
|
op.alter_column("builder_diseases", "category_code", type_=sa.String(256), schema=CONTENT_SCHEMA)
|
||||||
|
op.alter_column("builder_diseases", "disease_code", type_=sa.String(256), schema=CONTENT_SCHEMA)
|
||||||
|
op.alter_column("builder_patterns", "category_code", type_=sa.String(256), schema=CONTENT_SCHEMA)
|
||||||
|
op.alter_column("builder_patterns", "disease_code", type_=sa.String(256), schema=CONTENT_SCHEMA)
|
||||||
|
op.alter_column("builder_patterns", "pattern_code", type_=sa.String(256), schema=CONTENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
bind = op.get_bind()
|
bind = op.get_bind()
|
||||||
|
|
|
||||||
|
|
@ -948,7 +948,7 @@ class BuilderCategory(Base):
|
||||||
PGUUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
|
PGUUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
|
||||||
)
|
)
|
||||||
module_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
module_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||||
category_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
category_code: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
overview: Mapped[str | None] = mapped_column(Text)
|
overview: Mapped[str | None] = mapped_column(Text)
|
||||||
sort_order: Mapped[int] = mapped_column(Integer, nullable=False, server_default=text("0"))
|
sort_order: Mapped[int] = mapped_column(Integer, nullable=False, server_default=text("0"))
|
||||||
|
|
@ -986,8 +986,8 @@ class BuilderDisease(Base):
|
||||||
PGUUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
|
PGUUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
|
||||||
)
|
)
|
||||||
module_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
module_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||||
category_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
category_code: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||||
disease_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
disease_code: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
overview: Mapped[str | None] = mapped_column(Text)
|
overview: Mapped[str | None] = mapped_column(Text)
|
||||||
sort_order: Mapped[int] = mapped_column(Integer, nullable=False, server_default=text("0"))
|
sort_order: Mapped[int] = mapped_column(Integer, nullable=False, server_default=text("0"))
|
||||||
|
|
@ -1025,9 +1025,9 @@ class BuilderPattern(Base):
|
||||||
PGUUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
|
PGUUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
|
||||||
)
|
)
|
||||||
module_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
module_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||||
category_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
category_code: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||||
disease_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
disease_code: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||||
pattern_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
pattern_code: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
description: Mapped[str | None] = mapped_column(Text)
|
description: Mapped[str | None] = mapped_column(Text)
|
||||||
clinical_data: Mapped[dict[str, Any]] = mapped_column(
|
clinical_data: Mapped[dict[str, Any]] = mapped_column(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue