gabriel / musehub public
0069_proposal_comment_provenance.py python
52 lines 2.1 KB
Raw
sha256:94ef169c149a452bff7c604ded8b280b19bd477c2dabcb56972780b0b784c7aa Merge 'fix/assignee-sigil-inline' into 'dev' — proposal: As… Human 2 days ago
1 """Add provenance + lifecycle fields to musehub_proposal_comments.
2
3 author_user_id VARCHAR(128) nullable — content-addressed identity ID;
4 enables sigil without extra DB lookup
5 and survives handle changes.
6 Backfill via backfill_comment_author_user_ids.
7
8 agent_id VARCHAR(255) nullable — AI agent identifier (empty = human)
9 model_id VARCHAR(255) nullable — model that authored the comment
10
11 updated_at TIMESTAMPTZ nullable — set on edit; NULL = never edited
12
13 is_deleted BOOLEAN NOT NULL — soft-delete (consistent with issue comments)
14 DEFAULT FALSE
15
16 Revision ID: 0069
17 Revises: 0068
18 """
19 from __future__ import annotations
20
21 import sqlalchemy as sa
22 from alembic import op
23
24 revision = "0069"
25 down_revision = "0068"
26 branch_labels = None
27 depends_on = None
28
29
30 def upgrade() -> None:
31 op.add_column("musehub_proposal_comments",
32 sa.Column("author_user_id", sa.String(128), nullable=True))
33 op.add_column("musehub_proposal_comments",
34 sa.Column("agent_id", sa.String(255), nullable=True))
35 op.add_column("musehub_proposal_comments",
36 sa.Column("model_id", sa.String(255), nullable=True))
37 op.add_column("musehub_proposal_comments",
38 sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True))
39 op.add_column("musehub_proposal_comments",
40 sa.Column("is_deleted", sa.Boolean(), nullable=False,
41 server_default=sa.text("false")))
42 op.create_index("ix_musehub_proposal_comments_author_user_id",
43 "musehub_proposal_comments", ["author_user_id"])
44
45
46 def downgrade() -> None:
47 op.execute("DROP INDEX IF EXISTS ix_musehub_proposal_comments_author_user_id")
48 op.drop_column("musehub_proposal_comments", "is_deleted")
49 op.drop_column("musehub_proposal_comments", "updated_at")
50 op.drop_column("musehub_proposal_comments", "model_id")
51 op.drop_column("musehub_proposal_comments", "agent_id")
52 op.drop_column("musehub_proposal_comments", "author_user_id")
File History 1 commit
sha256:94ef169c149a452bff7c604ded8b280b19bd477c2dabcb56972780b0b784c7aa Merge 'fix/assignee-sigil-inline' into 'dev' — proposal: As… Human 2 days ago