gabriel / musehub public

0012_velocity_extended_columns.py file-level

at sha256:3 · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:0 fix: fall back to any indexed mpack in read_object_bytes when push mpac… · gabriel · Jun 17, 2026
1 """velocity: add prior_modified, prior_active_commits, window_size, commits_analysed
2
3 Revision ID: 0012
4 Revises: 0011
5 """
6
7 from __future__ import annotations
8
9 from typing import Union
10
11 import sqlalchemy as sa
12 from alembic import op
13
14 revision: str = "0012"
15 down_revision: Union[str, None] = "0011"
16 branch_labels = None
17 depends_on = None
18
19
20 def upgrade() -> None:
21 op.add_column(
22 "musehub_intel_velocity",
23 sa.Column("prior_modified", sa.Integer(), nullable=False, server_default="0"),
24 )
25 op.add_column(
26 "musehub_intel_velocity",
27 sa.Column("prior_active_commits", sa.Integer(), nullable=False, server_default="0"),
28 )
29 op.add_column(
30 "musehub_intel_velocity",
31 sa.Column("window_size", sa.Integer(), nullable=False, server_default="20"),
32 )
33 op.add_column(
34 "musehub_intel_velocity",
35 sa.Column("commits_analysed", sa.Integer(), nullable=False, server_default="0"),
36 )
37 op.create_index(
38 "ix_intel_velocity_repo_active",
39 "musehub_intel_velocity",
40 ["repo_id", "active_commits"],
41 )
42
43
44 def downgrade() -> None:
45 op.drop_index("ix_intel_velocity_repo_active", table_name="musehub_intel_velocity")
46 op.drop_column("musehub_intel_velocity", "commits_analysed")
47 op.drop_column("musehub_intel_velocity", "window_size")
48 op.drop_column("musehub_intel_velocity", "prior_active_commits")
49 op.drop_column("musehub_intel_velocity", "prior_modified")