From 30424df7ce35a446eada2ed2adfcd4da06d5a6c3 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Tue, 13 Jan 2026 17:20:02 +0800 Subject: [PATCH] uuid v7 --- ...5_10_31_1726-227822d22895_add_workflow_comments_table.py | 2 +- api/models/comment.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/migrations/versions/2025_10_31_1726-227822d22895_add_workflow_comments_table.py b/api/migrations/versions/2025_10_31_1726-227822d22895_add_workflow_comments_table.py index 6d1f92728e..c58b055be3 100644 --- a/api/migrations/versions/2025_10_31_1726-227822d22895_add_workflow_comments_table.py +++ b/api/migrations/versions/2025_10_31_1726-227822d22895_add_workflow_comments_table.py @@ -53,7 +53,7 @@ def upgrade(): batch_op.create_index('comment_replies_created_at_idx', ['created_at'], unique=False) op.create_table('workflow_comment_mentions', - sa.Column('id', models.types.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False), + sa.Column('id', models.types.StringUUID(), server_default=sa.text('uuidv7()'), nullable=False), sa.Column('comment_id', models.types.StringUUID(), nullable=False), sa.Column('reply_id', models.types.StringUUID(), nullable=True), sa.Column('mentioned_user_id', models.types.StringUUID(), nullable=False), diff --git a/api/models/comment.py b/api/models/comment.py index 5bc79aae67..ff675367d6 100644 --- a/api/models/comment.py +++ b/api/models/comment.py @@ -44,7 +44,7 @@ class WorkflowComment(Base): Index("workflow_comments_created_at_idx", "created_at"), ) - id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()")) + id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuidv7()")) tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False) app_id: Mapped[str] = mapped_column(StringUUID, nullable=False) position_x: Mapped[float] = mapped_column(db.Float) @@ -135,7 +135,7 @@ class WorkflowCommentReply(Base): Index("comment_replies_created_at_idx", "created_at"), ) - id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()")) + id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuidv7()")) comment_id: Mapped[str] = mapped_column( StringUUID, db.ForeignKey("workflow_comments.id", ondelete="CASCADE"), nullable=False ) @@ -176,7 +176,7 @@ class WorkflowCommentMention(Base): Index("comment_mentions_user_idx", "mentioned_user_id"), ) - id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()")) + id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuidv7()")) comment_id: Mapped[str] = mapped_column( StringUUID, db.ForeignKey("workflow_comments.id", ondelete="CASCADE"), nullable=False )