fix(payouts): status-Spalte mit echtem DB-Default statt nur Python-Default
Model hatte nur default= (ORM-seitig), kein server_default. Test-DB nutzt Base.metadata.create_all statt Alembic-Migrationen -> Spalte war dort NOT NULL ohne DB-Default, raw-SQL-Inserts (test_rls.py) schlugen fehl. Prod-DB hat den Default bereits aus Migration 0042 - hier nur Model nachgezogen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gis16MnuwkYcivLrSxK1pD
This commit is contained in:
@@ -40,7 +40,10 @@ class HoursPayout(Base):
|
||||
period_year: Mapped[int | None] = mapped_column(Integer) # Abrechnungsmonat Jahr
|
||||
period_month: Mapped[int | None] = mapped_column(Integer) # Abrechnungsmonat Monat
|
||||
note: Mapped[str | None] = mapped_column(Text) # Notiz für Buchhaltung
|
||||
status: Mapped[str] = mapped_column(String(12), nullable=False, default=PayoutStatus.APPROVED.value)
|
||||
status: Mapped[str] = mapped_column(
|
||||
String(12), nullable=False,
|
||||
default=PayoutStatus.APPROVED.value, server_default=PayoutStatus.APPROVED.value,
|
||||
)
|
||||
rejection_reason: Mapped[str | None] = mapped_column(Text)
|
||||
created_by: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("users.id", ondelete="SET NULL"),
|
||||
|
||||
Reference in New Issue
Block a user