修复audit_logs记录时主键缺失的问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from uuid import UUID
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
from sqlalchemy import Boolean, DateTime, Integer, String, Text
|
from sqlalchemy import Boolean, DateTime, Integer, String, Text
|
||||||
from sqlalchemy.dialects.postgresql import JSONB, UUID as PGUUID
|
from sqlalchemy.dialects.postgresql import JSONB, UUID as PGUUID
|
||||||
@@ -95,7 +95,9 @@ class UserProjectMembership(Base):
|
|||||||
class AuditLog(Base):
|
class AuditLog(Base):
|
||||||
__tablename__ = "audit_logs"
|
__tablename__ = "audit_logs"
|
||||||
|
|
||||||
id: Mapped[UUID] = mapped_column(PGUUID(as_uuid=True), primary_key=True)
|
id: Mapped[UUID] = mapped_column(
|
||||||
|
PGUUID(as_uuid=True), primary_key=True, default=uuid4
|
||||||
|
)
|
||||||
user_id: Mapped[UUID | None] = mapped_column(
|
user_id: Mapped[UUID | None] = mapped_column(
|
||||||
PGUUID(as_uuid=True), nullable=True, index=True
|
PGUUID(as_uuid=True), nullable=True, index=True
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user