gabriel / musehub public
0012_velocity_extended_columns.py python
49 lines 1.4 KB
Raw
sha256:c2e5cf2d754ed2fe9a94e879d41ad12ff221d2ac4ac7b45247fcb981c76858bf docs: Section 8 database/migrations/backups — verified live… Sonnet 5 24 days ago
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")
File History 2 commits
sha256:c2e5cf2d754ed2fe9a94e879d41ad12ff221d2ac4ac7b45247fcb981c76858bf docs: Section 8 database/migrations/backups — verified live… Sonnet 5 24 days ago
sha256:80e1a60a39562f6e616aaafbb27487f03abbec7d8ffc6164302b7a0c0bfc63ee docs: check off Section 0 items verified in inventory doc, … Sonnet 5 24 days ago