refactor: replace sa.String with EnumText in mapped_column for type s… (#33332)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
tmimmanuel
2026-03-14 04:38:27 +00:00
committed by GitHub
parent 6043ec4423
commit e64f4d6039
40 changed files with 218 additions and 138 deletions

View File

@ -13,7 +13,7 @@ from libs.uuid_utils import uuidv7
from .base import TypeBase
from .engine import db
from .types import LongText, StringUUID
from .types import EnumText, LongText, StringUUID
class ProviderType(StrEnum):
@ -69,8 +69,8 @@ class Provider(TypeBase):
)
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
provider_name: Mapped[str] = mapped_column(String(255), nullable=False)
provider_type: Mapped[str] = mapped_column(
String(40), nullable=False, server_default=text("'custom'"), default="custom"
provider_type: Mapped[ProviderType] = mapped_column(
EnumText(ProviderType, length=40), nullable=False, server_default=text("'custom'"), default=ProviderType.CUSTOM
)
is_valid: Mapped[bool] = mapped_column(sa.Boolean, nullable=False, server_default=text("false"), default=False)
last_used: Mapped[datetime | None] = mapped_column(DateTime, nullable=True, init=False)