git-contribution-analyzer 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_contribution_analyzer/__init__.py +3 -0
- git_contribution_analyzer/adapters/__init__.py +1 -0
- git_contribution_analyzer/adapters/git/__init__.py +1 -0
- git_contribution_analyzer/adapters/git/local_identity.py +51 -0
- git_contribution_analyzer/adapters/git/native_git.py +353 -0
- git_contribution_analyzer/adapters/git/pydriller_history.py +57 -0
- git_contribution_analyzer/adapters/git/repository_discovery.py +75 -0
- git_contribution_analyzer/adapters/gui/__init__.py +1 -0
- git_contribution_analyzer/adapters/gui/app.py +63 -0
- git_contribution_analyzer/adapters/gui/controller.py +1084 -0
- git_contribution_analyzer/adapters/gui/models/__init__.py +3 -0
- git_contribution_analyzer/adapters/gui/models/base_table.py +108 -0
- git_contribution_analyzer/adapters/gui/settings.py +53 -0
- git_contribution_analyzer/adapters/gui/task_runner.py +196 -0
- git_contribution_analyzer/adapters/llm/__init__.py +1 -0
- git_contribution_analyzer/adapters/llm/anthropic.py +52 -0
- git_contribution_analyzer/adapters/llm/base.py +142 -0
- git_contribution_analyzer/adapters/llm/cache.py +148 -0
- git_contribution_analyzer/adapters/llm/claude_cli.py +52 -0
- git_contribution_analyzer/adapters/llm/codex_cli.py +52 -0
- git_contribution_analyzer/adapters/llm/command_base.py +153 -0
- git_contribution_analyzer/adapters/llm/mock.py +82 -0
- git_contribution_analyzer/adapters/llm/ollama.py +53 -0
- git_contribution_analyzer/adapters/llm/openai_compatible.py +61 -0
- git_contribution_analyzer/adapters/llm/registry.py +117 -0
- git_contribution_analyzer/adapters/mcp/__init__.py +13 -0
- git_contribution_analyzer/adapters/mcp/installer.py +175 -0
- git_contribution_analyzer/adapters/mcp/prompts_resources.py +218 -0
- git_contribution_analyzer/adapters/mcp/protocol.py +361 -0
- git_contribution_analyzer/adapters/mcp/server.py +52 -0
- git_contribution_analyzer/adapters/mcp/tools.py +621 -0
- git_contribution_analyzer/adapters/outcomes/__init__.py +1 -0
- git_contribution_analyzer/adapters/outcomes/yaml_loader.py +55 -0
- git_contribution_analyzer/adapters/outcomes/yaml_store.py +104 -0
- git_contribution_analyzer/adapters/reporting/__init__.py +1 -0
- git_contribution_analyzer/adapters/reporting/brag_markdown.py +115 -0
- git_contribution_analyzer/adapters/reporting/html_report.py +1413 -0
- git_contribution_analyzer/adapters/reporting/markdown.py +217 -0
- git_contribution_analyzer/adapters/reporting/portfolio_markdown.py +167 -0
- git_contribution_analyzer/adapters/reporting/recap_markdown.py +212 -0
- git_contribution_analyzer/adapters/reporting/resume_markdown.py +37 -0
- git_contribution_analyzer/adapters/reporting/work_assessment_csv.py +117 -0
- git_contribution_analyzer/adapters/reporting/work_assessment_markdown.py +90 -0
- git_contribution_analyzer/adapters/reporting/work_assessment_series_markdown.py +31 -0
- git_contribution_analyzer/adapters/storage/__init__.py +1 -0
- git_contribution_analyzer/adapters/storage/sqlite/__init__.py +1 -0
- git_contribution_analyzer/adapters/storage/sqlite/analysis.py +708 -0
- git_contribution_analyzer/adapters/storage/sqlite/database.py +98 -0
- git_contribution_analyzer/adapters/storage/sqlite/git_index.py +482 -0
- git_contribution_analyzer/adapters/storage/sqlite/identity_merge.py +373 -0
- git_contribution_analyzer/adapters/storage/sqlite/llm_audit.py +109 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/env.py +34 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/script.py.mako +22 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0001_initial.py +51 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0002_git_index.py +146 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0003_analysis.py +79 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0004_llm_audit.py +69 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0005_run_types.py +42 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0006_identity_merges.py +83 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0007_structural_baselines.py +173 -0
- git_contribution_analyzer/adapters/storage/sqlite/models.py +354 -0
- git_contribution_analyzer/adapters/storage/sqlite/structural_baseline.py +841 -0
- git_contribution_analyzer/adapters/workspace/__init__.py +1 -0
- git_contribution_analyzer/adapters/workspace/config.py +135 -0
- git_contribution_analyzer/adapters/workspace/git_exclude.py +32 -0
- git_contribution_analyzer/adapters/workspace/layout.py +40 -0
- git_contribution_analyzer/adapters/workspace/locks.py +27 -0
- git_contribution_analyzer/adapters/workspace/portfolio_workspace.py +380 -0
- git_contribution_analyzer/adapters/workspace/ranking_config.py +17 -0
- git_contribution_analyzer/application/__init__.py +1 -0
- git_contribution_analyzer/application/dto/__init__.py +19 -0
- git_contribution_analyzer/application/dto/gui.py +86 -0
- git_contribution_analyzer/application/dto/results.py +21 -0
- git_contribution_analyzer/application/facades/__init__.py +3 -0
- git_contribution_analyzer/application/facades/gui.py +568 -0
- git_contribution_analyzer/application/ports/__init__.py +22 -0
- git_contribution_analyzer/application/ports/cancellation.py +50 -0
- git_contribution_analyzer/application/ports/git_history.py +22 -0
- git_contribution_analyzer/application/ports/llm.py +44 -0
- git_contribution_analyzer/application/ports/portfolio_store.py +34 -0
- git_contribution_analyzer/application/ports/progress.py +43 -0
- git_contribution_analyzer/application/ports/structural_baseline.py +93 -0
- git_contribution_analyzer/application/services/__init__.py +1 -0
- git_contribution_analyzer/application/services/assessment_explanation.py +127 -0
- git_contribution_analyzer/application/services/default_person.py +61 -0
- git_contribution_analyzer/application/services/evidence_snapshot.py +64 -0
- git_contribution_analyzer/application/services/person_selection.py +88 -0
- git_contribution_analyzer/application/services/resume_generation.py +318 -0
- git_contribution_analyzer/application/services/semantic_enhancement.py +157 -0
- git_contribution_analyzer/application/services/time_boundaries.py +49 -0
- git_contribution_analyzer/application/use_cases/__init__.py +1 -0
- git_contribution_analyzer/application/use_cases/analyze_contributions.py +276 -0
- git_contribution_analyzer/application/use_cases/analyze_project.py +295 -0
- git_contribution_analyzer/application/use_cases/assess_portfolio.py +327 -0
- git_contribution_analyzer/application/use_cases/assess_work.py +602 -0
- git_contribution_analyzer/application/use_cases/assess_work_series.py +212 -0
- git_contribution_analyzer/application/use_cases/compare_assessment_runs.py +121 -0
- git_contribution_analyzer/application/use_cases/export_report.py +49 -0
- git_contribution_analyzer/application/use_cases/generate_brag.py +308 -0
- git_contribution_analyzer/application/use_cases/generate_portfolio_recap.py +244 -0
- git_contribution_analyzer/application/use_cases/generate_portfolio_resume.py +152 -0
- git_contribution_analyzer/application/use_cases/generate_recap.py +316 -0
- git_contribution_analyzer/application/use_cases/generate_report.py +32 -0
- git_contribution_analyzer/application/use_cases/generate_resume.py +209 -0
- git_contribution_analyzer/application/use_cases/get_portfolio_status.py +83 -0
- git_contribution_analyzer/application/use_cases/get_run.py +16 -0
- git_contribution_analyzer/application/use_cases/get_status.py +69 -0
- git_contribution_analyzer/application/use_cases/index_repository.py +267 -0
- git_contribution_analyzer/application/use_cases/init_portfolio.py +89 -0
- git_contribution_analyzer/application/use_cases/init_project.py +71 -0
- git_contribution_analyzer/application/use_cases/list_identities.py +16 -0
- git_contribution_analyzer/application/use_cases/list_providers.py +29 -0
- git_contribution_analyzer/application/use_cases/list_runs.py +17 -0
- git_contribution_analyzer/application/use_cases/manage_identity_merges.py +48 -0
- git_contribution_analyzer/application/use_cases/manage_outcomes.py +189 -0
- git_contribution_analyzer/application/use_cases/manage_structural_baselines.py +262 -0
- git_contribution_analyzer/application/use_cases/map_identity.py +28 -0
- git_contribution_analyzer/application/use_cases/recover_runs.py +22 -0
- git_contribution_analyzer/application/use_cases/run_doctor.py +81 -0
- git_contribution_analyzer/application/use_cases/sync_portfolio.py +232 -0
- git_contribution_analyzer/application/use_cases/test_provider.py +22 -0
- git_contribution_analyzer/application/use_cases/uninit_project.py +23 -0
- git_contribution_analyzer/application/use_cases/verify_portfolio.py +165 -0
- git_contribution_analyzer/cli/__init__.py +1 -0
- git_contribution_analyzer/cli/app.py +1430 -0
- git_contribution_analyzer/cli/exit_codes.py +13 -0
- git_contribution_analyzer/cli/output.py +26 -0
- git_contribution_analyzer/cli/portfolio_commands.py +629 -0
- git_contribution_analyzer/domain/__init__.py +1 -0
- git_contribution_analyzer/domain/errors.py +55 -0
- git_contribution_analyzer/domain/models/__init__.py +3 -0
- git_contribution_analyzer/domain/models/analysis.py +29 -0
- git_contribution_analyzer/domain/models/assessment.py +12 -0
- git_contribution_analyzer/domain/models/brag.py +148 -0
- git_contribution_analyzer/domain/models/contribution.py +55 -0
- git_contribution_analyzer/domain/models/git_history.py +69 -0
- git_contribution_analyzer/domain/models/person_selection.py +46 -0
- git_contribution_analyzer/domain/models/portfolio.py +498 -0
- git_contribution_analyzer/domain/models/ranking.py +48 -0
- git_contribution_analyzer/domain/models/recap.py +235 -0
- git_contribution_analyzer/domain/models/repository.py +10 -0
- git_contribution_analyzer/domain/models/resume.py +59 -0
- git_contribution_analyzer/domain/models/run.py +10 -0
- git_contribution_analyzer/domain/models/semantic.py +34 -0
- git_contribution_analyzer/domain/models/snapshot.py +208 -0
- git_contribution_analyzer/domain/models/structural_baseline.py +120 -0
- git_contribution_analyzer/domain/models/work_assessment.py +81 -0
- git_contribution_analyzer/domain/services/assessment_periods.py +182 -0
- git_contribution_analyzer/domain/services/brag_rules.py +250 -0
- git_contribution_analyzer/domain/services/capability_rules.py +91 -0
- git_contribution_analyzer/domain/services/contribution_clustering.py +98 -0
- git_contribution_analyzer/domain/services/contribution_rules.py +79 -0
- git_contribution_analyzer/domain/services/difficulty_rules.py +191 -0
- git_contribution_analyzer/domain/services/dimensional_summary.py +117 -0
- git_contribution_analyzer/domain/services/portfolio_aggregation.py +250 -0
- git_contribution_analyzer/domain/services/portfolio_resume_rules.py +265 -0
- git_contribution_analyzer/domain/services/portfolio_verifier.py +238 -0
- git_contribution_analyzer/domain/services/ranking_rules.py +226 -0
- git_contribution_analyzer/domain/services/recap_rules.py +268 -0
- git_contribution_analyzer/domain/services/resume_claim_rules.py +70 -0
- git_contribution_analyzer/domain/services/structural_baseline.py +317 -0
- git_contribution_analyzer/domain/services/structural_signals.py +151 -0
- git_contribution_analyzer/domain/services/workload_rules.py +185 -0
- git_contribution_analyzer/gui/__init__.py +1 -0
- git_contribution_analyzer/gui/qml/Main.qml +1141 -0
- git_contribution_analyzer/gui/qml/__init__.py +1 -0
- git_contribution_analyzer/prompts/__init__.py +1 -0
- git_contribution_analyzer/prompts/assessment/__init__.py +1 -0
- git_contribution_analyzer/prompts/assessment/v1/__init__.py +1 -0
- git_contribution_analyzer/prompts/assessment/v1/explanation.txt +4 -0
- git_contribution_analyzer/prompts/resume/__init__.py +1 -0
- git_contribution_analyzer/prompts/resume/v1/__init__.py +1 -0
- git_contribution_analyzer/prompts/resume/v1/style-concise.txt +1 -0
- git_contribution_analyzer/prompts/resume/v1/style-star.txt +1 -0
- git_contribution_analyzer/prompts/resume/v1/style-xyz.txt +1 -0
- git_contribution_analyzer/prompts/resume/v1/system.txt +3 -0
- git_contribution_analyzer/prompts/v1/__init__.py +1 -0
- git_contribution_analyzer/prompts/v1/capability_explanation.txt +2 -0
- git_contribution_analyzer/prompts/v1/contribution_summary.txt +2 -0
- git_contribution_analyzer/prompts/v1/overall_summary.txt +2 -0
- git_contribution_analyzer/prompts/v1/resume_bullet.txt +2 -0
- git_contribution_analyzer-0.8.0.dist-info/METADATA +667 -0
- git_contribution_analyzer-0.8.0.dist-info/RECORD +187 -0
- git_contribution_analyzer-0.8.0.dist-info/WHEEL +4 -0
- git_contribution_analyzer-0.8.0.dist-info/entry_points.txt +3 -0
- git_contribution_analyzer-0.8.0.dist-info/licenses/LICENSE +201 -0
- git_contribution_analyzer-0.8.0.dist-info/licenses/NOTICE +6 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""Add Git history, identity, and delivery index tables."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "0002_git_index"
|
|
7
|
+
down_revision = "0001_initial"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.create_table(
|
|
14
|
+
"refs",
|
|
15
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
16
|
+
sa.Column("ref_name", sa.String(), nullable=False),
|
|
17
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
18
|
+
sa.Column("ref_type", sa.String(length=20), nullable=False),
|
|
19
|
+
sa.Column("active", sa.Boolean(), nullable=False),
|
|
20
|
+
sa.Column(
|
|
21
|
+
"observed_at",
|
|
22
|
+
sa.DateTime(timezone=True),
|
|
23
|
+
server_default=sa.func.now(),
|
|
24
|
+
nullable=False,
|
|
25
|
+
),
|
|
26
|
+
sa.ForeignKeyConstraint(["repository_id"], ["repositories.id"]),
|
|
27
|
+
sa.PrimaryKeyConstraint("repository_id", "ref_name"),
|
|
28
|
+
)
|
|
29
|
+
op.create_table(
|
|
30
|
+
"persons",
|
|
31
|
+
sa.Column("id", sa.String(length=36), primary_key=True),
|
|
32
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
33
|
+
sa.Column("canonical_name", sa.String(), nullable=False),
|
|
34
|
+
sa.Column("canonical_email", sa.String(), nullable=False),
|
|
35
|
+
sa.Column("kind", sa.String(length=20), nullable=False),
|
|
36
|
+
sa.Column("confirmed", sa.Boolean(), nullable=False),
|
|
37
|
+
sa.Column(
|
|
38
|
+
"created_at",
|
|
39
|
+
sa.DateTime(timezone=True),
|
|
40
|
+
server_default=sa.func.now(),
|
|
41
|
+
nullable=False,
|
|
42
|
+
),
|
|
43
|
+
sa.ForeignKeyConstraint(["repository_id"], ["repositories.id"]),
|
|
44
|
+
sa.UniqueConstraint(
|
|
45
|
+
"repository_id", "canonical_email", name="uq_person_repository_email"
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
op.create_table(
|
|
49
|
+
"identity_aliases",
|
|
50
|
+
sa.Column("id", sa.String(length=36), primary_key=True),
|
|
51
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
52
|
+
sa.Column("person_id", sa.String(length=36), nullable=False),
|
|
53
|
+
sa.Column("name", sa.String(), nullable=False),
|
|
54
|
+
sa.Column("email", sa.String(), nullable=False),
|
|
55
|
+
sa.Column("normalized_email", sa.String(), nullable=False),
|
|
56
|
+
sa.Column("source", sa.String(length=20), nullable=False),
|
|
57
|
+
sa.Column("confidence", sa.Float(), nullable=False),
|
|
58
|
+
sa.Column("confirmed", sa.Boolean(), nullable=False),
|
|
59
|
+
sa.Column("rationale", sa.Text(), nullable=True),
|
|
60
|
+
sa.ForeignKeyConstraint(["repository_id"], ["repositories.id"]),
|
|
61
|
+
sa.ForeignKeyConstraint(["person_id"], ["persons.id"]),
|
|
62
|
+
sa.UniqueConstraint(
|
|
63
|
+
"repository_id", "name", "email", name="uq_alias_repository_identity"
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
op.create_table(
|
|
67
|
+
"commits",
|
|
68
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
69
|
+
sa.Column("hash", sa.String(length=64), nullable=False),
|
|
70
|
+
sa.Column("author_alias_id", sa.String(length=36), nullable=False),
|
|
71
|
+
sa.Column("committer_name", sa.String(), nullable=False),
|
|
72
|
+
sa.Column("committer_email", sa.String(), nullable=False),
|
|
73
|
+
sa.Column("authored_at", sa.DateTime(timezone=True), nullable=False),
|
|
74
|
+
sa.Column("committed_at", sa.DateTime(timezone=True), nullable=False),
|
|
75
|
+
sa.Column("subject", sa.Text(), nullable=False),
|
|
76
|
+
sa.Column("body", sa.Text(), nullable=False),
|
|
77
|
+
sa.Column("is_merge", sa.Boolean(), nullable=False),
|
|
78
|
+
sa.Column("tree_hash", sa.String(length=64), nullable=False),
|
|
79
|
+
sa.Column("patch_id", sa.String(length=64), nullable=True),
|
|
80
|
+
sa.Column("reverts_hash", sa.String(length=64), nullable=True),
|
|
81
|
+
sa.Column("insertions", sa.Integer(), nullable=False),
|
|
82
|
+
sa.Column("deletions", sa.Integer(), nullable=False),
|
|
83
|
+
sa.Column("files_changed", sa.Integer(), nullable=False),
|
|
84
|
+
sa.Column(
|
|
85
|
+
"indexed_at",
|
|
86
|
+
sa.DateTime(timezone=True),
|
|
87
|
+
server_default=sa.func.now(),
|
|
88
|
+
nullable=False,
|
|
89
|
+
),
|
|
90
|
+
sa.ForeignKeyConstraint(["author_alias_id"], ["identity_aliases.id"]),
|
|
91
|
+
sa.ForeignKeyConstraint(["repository_id"], ["repositories.id"]),
|
|
92
|
+
sa.PrimaryKeyConstraint("repository_id", "hash"),
|
|
93
|
+
)
|
|
94
|
+
op.create_index("ix_commits_author_date", "commits", ["author_alias_id", "authored_at"])
|
|
95
|
+
op.create_index("ix_commits_patch_id", "commits", ["patch_id"])
|
|
96
|
+
op.create_table(
|
|
97
|
+
"commit_parents",
|
|
98
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
99
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
100
|
+
sa.Column("parent_index", sa.Integer(), nullable=False),
|
|
101
|
+
sa.Column("parent_hash", sa.String(length=64), nullable=False),
|
|
102
|
+
sa.PrimaryKeyConstraint("repository_id", "commit_hash", "parent_index"),
|
|
103
|
+
)
|
|
104
|
+
op.create_table(
|
|
105
|
+
"file_changes",
|
|
106
|
+
sa.Column("id", sa.Integer(), autoincrement=True, primary_key=True),
|
|
107
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
108
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
109
|
+
sa.Column("old_path", sa.Text(), nullable=True),
|
|
110
|
+
sa.Column("new_path", sa.Text(), nullable=True),
|
|
111
|
+
sa.Column("change_type", sa.String(length=20), nullable=False),
|
|
112
|
+
sa.Column("is_binary", sa.Boolean(), nullable=False),
|
|
113
|
+
sa.Column("is_excluded", sa.Boolean(), nullable=False),
|
|
114
|
+
sa.Column("insertions", sa.Integer(), nullable=False),
|
|
115
|
+
sa.Column("deletions", sa.Integer(), nullable=False),
|
|
116
|
+
)
|
|
117
|
+
op.create_index("ix_file_changes_commit", "file_changes", ["repository_id", "commit_hash"])
|
|
118
|
+
op.create_table(
|
|
119
|
+
"commit_delivery",
|
|
120
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
121
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
122
|
+
sa.Column("target_ref", sa.String(), nullable=False),
|
|
123
|
+
sa.Column("status", sa.String(length=20), nullable=False),
|
|
124
|
+
sa.Column("release_ref", sa.String(), nullable=True),
|
|
125
|
+
sa.Column("related_commit_hash", sa.String(length=64), nullable=True),
|
|
126
|
+
sa.Column(
|
|
127
|
+
"evaluated_at",
|
|
128
|
+
sa.DateTime(timezone=True),
|
|
129
|
+
server_default=sa.func.now(),
|
|
130
|
+
nullable=False,
|
|
131
|
+
),
|
|
132
|
+
sa.PrimaryKeyConstraint("repository_id", "commit_hash", "target_ref"),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def downgrade() -> None:
|
|
137
|
+
op.drop_table("commit_delivery")
|
|
138
|
+
op.drop_index("ix_file_changes_commit", table_name="file_changes")
|
|
139
|
+
op.drop_table("file_changes")
|
|
140
|
+
op.drop_table("commit_parents")
|
|
141
|
+
op.drop_index("ix_commits_patch_id", table_name="commits")
|
|
142
|
+
op.drop_index("ix_commits_author_date", table_name="commits")
|
|
143
|
+
op.drop_table("commits")
|
|
144
|
+
op.drop_table("identity_aliases")
|
|
145
|
+
op.drop_table("persons")
|
|
146
|
+
op.drop_table("refs")
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Add deterministic analysis runs, evidence, and report persistence."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "0003_analysis"
|
|
7
|
+
down_revision = "0002_git_index"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.add_column("analysis_runs", sa.Column("person_id", sa.String(length=36), nullable=True))
|
|
14
|
+
op.add_column(
|
|
15
|
+
"analysis_runs",
|
|
16
|
+
sa.Column("parameters_json", sa.Text(), server_default="{}", nullable=False),
|
|
17
|
+
)
|
|
18
|
+
op.add_column(
|
|
19
|
+
"analysis_runs", sa.Column("baseline_commit", sa.String(length=64), nullable=True)
|
|
20
|
+
)
|
|
21
|
+
op.add_column(
|
|
22
|
+
"analysis_runs",
|
|
23
|
+
sa.Column("rule_version", sa.String(length=40), server_default="rules-v1", nullable=False),
|
|
24
|
+
)
|
|
25
|
+
op.add_column(
|
|
26
|
+
"analysis_runs",
|
|
27
|
+
sa.Column("provider_id", sa.String(length=40), server_default="none", nullable=False),
|
|
28
|
+
)
|
|
29
|
+
op.add_column("analysis_runs", sa.Column("result_json", sa.Text(), nullable=True))
|
|
30
|
+
op.add_column("analysis_runs", sa.Column("error_message", sa.Text(), nullable=True))
|
|
31
|
+
op.create_table(
|
|
32
|
+
"contribution_items",
|
|
33
|
+
sa.Column("run_id", sa.String(length=36), nullable=False),
|
|
34
|
+
sa.Column("item_id", sa.String(length=20), nullable=False),
|
|
35
|
+
sa.Column("item_order", sa.Integer(), nullable=False),
|
|
36
|
+
sa.Column("group_key", sa.String(), nullable=False),
|
|
37
|
+
sa.Column("title", sa.Text(), nullable=False),
|
|
38
|
+
sa.Column("confidence", sa.String(length=20), nullable=False),
|
|
39
|
+
sa.Column("commits_json", sa.Text(), nullable=False),
|
|
40
|
+
sa.Column("evidence_ids_json", sa.Text(), nullable=False),
|
|
41
|
+
sa.ForeignKeyConstraint(["run_id"], ["analysis_runs.id"]),
|
|
42
|
+
sa.PrimaryKeyConstraint("run_id", "item_id"),
|
|
43
|
+
)
|
|
44
|
+
op.create_table(
|
|
45
|
+
"evidence",
|
|
46
|
+
sa.Column("run_id", sa.String(length=36), nullable=False),
|
|
47
|
+
sa.Column("evidence_id", sa.String(length=20), nullable=False),
|
|
48
|
+
sa.Column("evidence_type", sa.String(length=40), nullable=False),
|
|
49
|
+
sa.Column("summary", sa.Text(), nullable=False),
|
|
50
|
+
sa.Column("commit_hashes_json", sa.Text(), nullable=False),
|
|
51
|
+
sa.Column("paths_json", sa.Text(), nullable=False),
|
|
52
|
+
sa.Column("metrics_json", sa.Text(), nullable=False),
|
|
53
|
+
sa.ForeignKeyConstraint(["run_id"], ["analysis_runs.id"]),
|
|
54
|
+
sa.PrimaryKeyConstraint("run_id", "evidence_id"),
|
|
55
|
+
)
|
|
56
|
+
op.create_table(
|
|
57
|
+
"capability_assessments",
|
|
58
|
+
sa.Column("run_id", sa.String(length=36), nullable=False),
|
|
59
|
+
sa.Column("capability", sa.String(length=60), nullable=False),
|
|
60
|
+
sa.Column("confidence", sa.String(length=20), nullable=False),
|
|
61
|
+
sa.Column("rationale", sa.Text(), nullable=False),
|
|
62
|
+
sa.Column("evidence_ids_json", sa.Text(), nullable=False),
|
|
63
|
+
sa.Column("gaps_json", sa.Text(), nullable=False),
|
|
64
|
+
sa.ForeignKeyConstraint(["run_id"], ["analysis_runs.id"]),
|
|
65
|
+
sa.PrimaryKeyConstraint("run_id", "capability"),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def downgrade() -> None:
|
|
70
|
+
op.drop_table("capability_assessments")
|
|
71
|
+
op.drop_table("evidence")
|
|
72
|
+
op.drop_table("contribution_items")
|
|
73
|
+
op.drop_column("analysis_runs", "error_message")
|
|
74
|
+
op.drop_column("analysis_runs", "result_json")
|
|
75
|
+
op.drop_column("analysis_runs", "provider_id")
|
|
76
|
+
op.drop_column("analysis_runs", "rule_version")
|
|
77
|
+
op.drop_column("analysis_runs", "baseline_commit")
|
|
78
|
+
op.drop_column("analysis_runs", "parameters_json")
|
|
79
|
+
op.drop_column("analysis_runs", "person_id")
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Add LLM invocation audit and response cache."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "0004_llm_audit"
|
|
7
|
+
down_revision = "0003_analysis"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.create_table(
|
|
14
|
+
"llm_cache",
|
|
15
|
+
sa.Column("request_hash", sa.String(length=64), nullable=False),
|
|
16
|
+
sa.Column("provider_id", sa.String(length=40), nullable=False),
|
|
17
|
+
sa.Column("model", sa.String(length=120), nullable=False),
|
|
18
|
+
sa.Column("prompt_version", sa.String(length=40), nullable=False),
|
|
19
|
+
sa.Column("schema_version", sa.String(length=40), nullable=False),
|
|
20
|
+
sa.Column("response_json", sa.Text(), nullable=False),
|
|
21
|
+
sa.Column(
|
|
22
|
+
"created_at",
|
|
23
|
+
sa.DateTime(timezone=True),
|
|
24
|
+
server_default=sa.func.now(),
|
|
25
|
+
nullable=False,
|
|
26
|
+
),
|
|
27
|
+
sa.Column(
|
|
28
|
+
"last_used_at",
|
|
29
|
+
sa.DateTime(timezone=True),
|
|
30
|
+
server_default=sa.func.now(),
|
|
31
|
+
nullable=False,
|
|
32
|
+
),
|
|
33
|
+
sa.PrimaryKeyConstraint("request_hash"),
|
|
34
|
+
)
|
|
35
|
+
op.create_table(
|
|
36
|
+
"llm_invocations",
|
|
37
|
+
sa.Column("id", sa.String(length=36), nullable=False),
|
|
38
|
+
sa.Column("run_id", sa.String(length=36), nullable=True),
|
|
39
|
+
sa.Column("request_hash", sa.String(length=64), nullable=False),
|
|
40
|
+
sa.Column("provider_id", sa.String(length=40), nullable=False),
|
|
41
|
+
sa.Column("model", sa.String(length=120), nullable=False),
|
|
42
|
+
sa.Column("prompt_version", sa.String(length=40), nullable=False),
|
|
43
|
+
sa.Column("schema_version", sa.String(length=40), nullable=False),
|
|
44
|
+
sa.Column("attempts", sa.Integer(), nullable=False),
|
|
45
|
+
sa.Column("latency_ms", sa.Integer(), nullable=False),
|
|
46
|
+
sa.Column("status", sa.String(length=20), nullable=False),
|
|
47
|
+
sa.Column("error_code", sa.String(length=40), nullable=True),
|
|
48
|
+
sa.Column("error_message", sa.Text(), nullable=True),
|
|
49
|
+
sa.Column("cache_hit", sa.Boolean(), server_default=sa.false(), nullable=False),
|
|
50
|
+
sa.Column(
|
|
51
|
+
"created_at",
|
|
52
|
+
sa.DateTime(timezone=True),
|
|
53
|
+
server_default=sa.func.now(),
|
|
54
|
+
nullable=False,
|
|
55
|
+
),
|
|
56
|
+
sa.ForeignKeyConstraint(["run_id"], ["analysis_runs.id"]),
|
|
57
|
+
sa.PrimaryKeyConstraint("id"),
|
|
58
|
+
)
|
|
59
|
+
op.create_index(
|
|
60
|
+
"ix_llm_invocations_request_hash", "llm_invocations", ["request_hash"]
|
|
61
|
+
)
|
|
62
|
+
op.create_index("ix_llm_invocations_run_id", "llm_invocations", ["run_id"])
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def downgrade() -> None:
|
|
66
|
+
op.drop_index("ix_llm_invocations_run_id", table_name="llm_invocations")
|
|
67
|
+
op.drop_index("ix_llm_invocations_request_hash", table_name="llm_invocations")
|
|
68
|
+
op.drop_table("llm_invocations")
|
|
69
|
+
op.drop_table("llm_cache")
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Add explicit analysis run types and lineage."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "0005_run_types"
|
|
7
|
+
down_revision = "0004_llm_audit"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.add_column(
|
|
14
|
+
"analysis_runs",
|
|
15
|
+
sa.Column(
|
|
16
|
+
"run_type",
|
|
17
|
+
sa.String(length=32),
|
|
18
|
+
server_default="ANALYSIS",
|
|
19
|
+
nullable=False,
|
|
20
|
+
),
|
|
21
|
+
)
|
|
22
|
+
op.add_column(
|
|
23
|
+
"analysis_runs",
|
|
24
|
+
sa.Column("parent_run_id", sa.String(length=36), nullable=True),
|
|
25
|
+
)
|
|
26
|
+
op.create_index(
|
|
27
|
+
"ix_analysis_runs_run_type",
|
|
28
|
+
"analysis_runs",
|
|
29
|
+
["repository_id", "run_type", "started_at"],
|
|
30
|
+
)
|
|
31
|
+
op.create_index(
|
|
32
|
+
"ix_analysis_runs_parent_run_id",
|
|
33
|
+
"analysis_runs",
|
|
34
|
+
["parent_run_id"],
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def downgrade() -> None:
|
|
39
|
+
op.drop_index("ix_analysis_runs_parent_run_id", table_name="analysis_runs")
|
|
40
|
+
op.drop_index("ix_analysis_runs_run_type", table_name="analysis_runs")
|
|
41
|
+
op.drop_column("analysis_runs", "parent_run_id")
|
|
42
|
+
op.drop_column("analysis_runs", "run_type")
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Add reversible identity merge state."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "0006_identity_merges"
|
|
7
|
+
down_revision = "0005_run_types"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.add_column(
|
|
14
|
+
"persons",
|
|
15
|
+
sa.Column("active", sa.Boolean(), server_default=sa.true(), nullable=False),
|
|
16
|
+
)
|
|
17
|
+
op.add_column(
|
|
18
|
+
"persons",
|
|
19
|
+
sa.Column("merged_into_person_id", sa.String(length=36), nullable=True),
|
|
20
|
+
)
|
|
21
|
+
op.create_index(
|
|
22
|
+
"ix_persons_active_identity",
|
|
23
|
+
"persons",
|
|
24
|
+
["repository_id", "active", "canonical_name", "canonical_email"],
|
|
25
|
+
)
|
|
26
|
+
op.create_index(
|
|
27
|
+
"ix_persons_merged_into_person_id",
|
|
28
|
+
"persons",
|
|
29
|
+
["merged_into_person_id"],
|
|
30
|
+
)
|
|
31
|
+
op.create_table(
|
|
32
|
+
"identity_merge_events",
|
|
33
|
+
sa.Column("id", sa.String(length=36), primary_key=True),
|
|
34
|
+
sa.Column(
|
|
35
|
+
"repository_id",
|
|
36
|
+
sa.String(length=36),
|
|
37
|
+
sa.ForeignKey("repositories.id"),
|
|
38
|
+
nullable=False,
|
|
39
|
+
),
|
|
40
|
+
sa.Column("event_type", sa.String(length=20), nullable=False),
|
|
41
|
+
sa.Column(
|
|
42
|
+
"target_person_id",
|
|
43
|
+
sa.String(length=36),
|
|
44
|
+
sa.ForeignKey("persons.id"),
|
|
45
|
+
nullable=False,
|
|
46
|
+
),
|
|
47
|
+
sa.Column("source_person_ids_json", sa.Text(), nullable=False),
|
|
48
|
+
sa.Column("moved_alias_ids_json", sa.Text(), nullable=False),
|
|
49
|
+
sa.Column("source_snapshots_json", sa.Text(), nullable=False),
|
|
50
|
+
sa.Column("status", sa.String(length=20), nullable=False),
|
|
51
|
+
sa.Column(
|
|
52
|
+
"created_at",
|
|
53
|
+
sa.DateTime(timezone=True),
|
|
54
|
+
server_default=sa.func.now(),
|
|
55
|
+
nullable=False,
|
|
56
|
+
),
|
|
57
|
+
sa.Column("reverted_at", sa.DateTime(timezone=True), nullable=True),
|
|
58
|
+
)
|
|
59
|
+
op.create_index(
|
|
60
|
+
"ix_identity_merge_events_status",
|
|
61
|
+
"identity_merge_events",
|
|
62
|
+
["repository_id", "status", "created_at"],
|
|
63
|
+
)
|
|
64
|
+
op.create_index(
|
|
65
|
+
"ix_identity_merge_events_target",
|
|
66
|
+
"identity_merge_events",
|
|
67
|
+
["repository_id", "target_person_id"],
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def downgrade() -> None:
|
|
72
|
+
active = op.get_bind().execute(
|
|
73
|
+
sa.text("SELECT COUNT(*) FROM identity_merge_events WHERE status = 'ACTIVE'")
|
|
74
|
+
).scalar_one()
|
|
75
|
+
if active:
|
|
76
|
+
raise RuntimeError("Cannot downgrade while ACTIVE identity merge events exist")
|
|
77
|
+
op.drop_index("ix_identity_merge_events_target", table_name="identity_merge_events")
|
|
78
|
+
op.drop_index("ix_identity_merge_events_status", table_name="identity_merge_events")
|
|
79
|
+
op.drop_table("identity_merge_events")
|
|
80
|
+
op.drop_index("ix_persons_merged_into_person_id", table_name="persons")
|
|
81
|
+
op.drop_index("ix_persons_active_identity", table_name="persons")
|
|
82
|
+
op.drop_column("persons", "merged_into_person_id")
|
|
83
|
+
op.drop_column("persons", "active")
|
git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0007_structural_baselines.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""Add versioned structural facts and baseline caches."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "0007_structural_baselines"
|
|
7
|
+
down_revision = "0006_identity_merges"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.create_table(
|
|
14
|
+
"structural_commit_facts",
|
|
15
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
16
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
17
|
+
sa.Column("fact_rule_version", sa.String(length=40), nullable=False),
|
|
18
|
+
sa.Column("occurred_at", sa.DateTime(timezone=True), nullable=False),
|
|
19
|
+
sa.Column("path_count", sa.Integer(), nullable=False),
|
|
20
|
+
sa.Column("edge_count", sa.Integer(), nullable=False),
|
|
21
|
+
sa.Column("context_capped", sa.Boolean(), nullable=False),
|
|
22
|
+
sa.Column("excluded_reason", sa.String(length=40), nullable=True),
|
|
23
|
+
sa.Column(
|
|
24
|
+
"processed_at",
|
|
25
|
+
sa.DateTime(timezone=True),
|
|
26
|
+
server_default=sa.func.now(),
|
|
27
|
+
nullable=False,
|
|
28
|
+
),
|
|
29
|
+
sa.ForeignKeyConstraint(["repository_id"], ["repositories.id"]),
|
|
30
|
+
sa.PrimaryKeyConstraint("repository_id", "commit_hash", "fact_rule_version"),
|
|
31
|
+
)
|
|
32
|
+
op.create_table(
|
|
33
|
+
"structural_file_occurrences",
|
|
34
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
35
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
36
|
+
sa.Column("fact_rule_version", sa.String(length=40), nullable=False),
|
|
37
|
+
sa.Column("path", sa.Text(), nullable=False),
|
|
38
|
+
sa.ForeignKeyConstraint(
|
|
39
|
+
["repository_id", "commit_hash", "fact_rule_version"],
|
|
40
|
+
[
|
|
41
|
+
"structural_commit_facts.repository_id",
|
|
42
|
+
"structural_commit_facts.commit_hash",
|
|
43
|
+
"structural_commit_facts.fact_rule_version",
|
|
44
|
+
],
|
|
45
|
+
ondelete="CASCADE",
|
|
46
|
+
),
|
|
47
|
+
sa.PrimaryKeyConstraint("repository_id", "commit_hash", "fact_rule_version", "path"),
|
|
48
|
+
)
|
|
49
|
+
op.create_index(
|
|
50
|
+
"ix_structural_file_occurrences_path",
|
|
51
|
+
"structural_file_occurrences",
|
|
52
|
+
["repository_id", "fact_rule_version", "path"],
|
|
53
|
+
)
|
|
54
|
+
op.create_table(
|
|
55
|
+
"structural_edge_occurrences",
|
|
56
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
57
|
+
sa.Column("commit_hash", sa.String(length=64), nullable=False),
|
|
58
|
+
sa.Column("fact_rule_version", sa.String(length=40), nullable=False),
|
|
59
|
+
sa.Column("left_path", sa.Text(), nullable=False),
|
|
60
|
+
sa.Column("right_path", sa.Text(), nullable=False),
|
|
61
|
+
sa.CheckConstraint("left_path < right_path", name="ck_structural_edge_order"),
|
|
62
|
+
sa.ForeignKeyConstraint(
|
|
63
|
+
["repository_id", "commit_hash", "fact_rule_version"],
|
|
64
|
+
[
|
|
65
|
+
"structural_commit_facts.repository_id",
|
|
66
|
+
"structural_commit_facts.commit_hash",
|
|
67
|
+
"structural_commit_facts.fact_rule_version",
|
|
68
|
+
],
|
|
69
|
+
ondelete="CASCADE",
|
|
70
|
+
),
|
|
71
|
+
sa.PrimaryKeyConstraint(
|
|
72
|
+
"repository_id",
|
|
73
|
+
"commit_hash",
|
|
74
|
+
"fact_rule_version",
|
|
75
|
+
"left_path",
|
|
76
|
+
"right_path",
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
op.create_index(
|
|
80
|
+
"ix_structural_edge_occurrences_paths",
|
|
81
|
+
"structural_edge_occurrences",
|
|
82
|
+
["repository_id", "fact_rule_version", "left_path", "right_path"],
|
|
83
|
+
)
|
|
84
|
+
op.create_table(
|
|
85
|
+
"structural_baselines",
|
|
86
|
+
sa.Column("id", sa.String(length=64), primary_key=True),
|
|
87
|
+
sa.Column("repository_id", sa.String(length=36), nullable=False),
|
|
88
|
+
sa.Column("baseline_commit", sa.String(length=64), nullable=True),
|
|
89
|
+
sa.Column("cutoff_at", sa.DateTime(timezone=True), nullable=False),
|
|
90
|
+
sa.Column("branch", sa.Text(), nullable=False),
|
|
91
|
+
sa.Column("scope", sa.Text(), nullable=True),
|
|
92
|
+
sa.Column("filter_fingerprint", sa.String(length=64), nullable=False),
|
|
93
|
+
sa.Column("time_strategy", sa.String(length=24), nullable=False),
|
|
94
|
+
sa.Column("fact_rule_version", sa.String(length=40), nullable=False),
|
|
95
|
+
sa.Column("metric_rule_version", sa.String(length=40), nullable=False),
|
|
96
|
+
sa.Column("threshold_version", sa.String(length=40), nullable=False),
|
|
97
|
+
sa.Column("status", sa.String(length=20), nullable=False),
|
|
98
|
+
sa.Column("eligible_commit_count", sa.Integer(), nullable=False),
|
|
99
|
+
sa.Column("eligible_file_count", sa.Integer(), nullable=False),
|
|
100
|
+
sa.Column("raw_edge_count", sa.Integer(), nullable=False),
|
|
101
|
+
sa.Column(
|
|
102
|
+
"created_at",
|
|
103
|
+
sa.DateTime(timezone=True),
|
|
104
|
+
server_default=sa.func.now(),
|
|
105
|
+
nullable=False,
|
|
106
|
+
),
|
|
107
|
+
sa.Column("completed_at", sa.DateTime(timezone=True), nullable=True),
|
|
108
|
+
sa.Column("error_message", sa.Text(), nullable=True),
|
|
109
|
+
sa.ForeignKeyConstraint(["repository_id"], ["repositories.id"]),
|
|
110
|
+
)
|
|
111
|
+
op.create_index(
|
|
112
|
+
"ix_structural_baselines_repository_status",
|
|
113
|
+
"structural_baselines",
|
|
114
|
+
["repository_id", "status", "cutoff_at"],
|
|
115
|
+
)
|
|
116
|
+
op.create_table(
|
|
117
|
+
"structural_file_counts",
|
|
118
|
+
sa.Column("baseline_id", sa.String(length=64), nullable=False),
|
|
119
|
+
sa.Column("path", sa.Text(), nullable=False),
|
|
120
|
+
sa.Column("change_count", sa.Integer(), nullable=False),
|
|
121
|
+
sa.Column("recent_change_count", sa.Integer(), nullable=False),
|
|
122
|
+
sa.ForeignKeyConstraint(
|
|
123
|
+
["baseline_id"], ["structural_baselines.id"], ondelete="CASCADE"
|
|
124
|
+
),
|
|
125
|
+
sa.PrimaryKeyConstraint("baseline_id", "path"),
|
|
126
|
+
)
|
|
127
|
+
op.create_table(
|
|
128
|
+
"structural_edge_counts",
|
|
129
|
+
sa.Column("baseline_id", sa.String(length=64), nullable=False),
|
|
130
|
+
sa.Column("left_path", sa.Text(), nullable=False),
|
|
131
|
+
sa.Column("right_path", sa.Text(), nullable=False),
|
|
132
|
+
sa.Column("co_change_count", sa.Integer(), nullable=False),
|
|
133
|
+
sa.Column("recent_co_change_count", sa.Integer(), nullable=False),
|
|
134
|
+
sa.ForeignKeyConstraint(
|
|
135
|
+
["baseline_id"], ["structural_baselines.id"], ondelete="CASCADE"
|
|
136
|
+
),
|
|
137
|
+
sa.PrimaryKeyConstraint("baseline_id", "left_path", "right_path"),
|
|
138
|
+
)
|
|
139
|
+
op.create_table(
|
|
140
|
+
"structural_materializations",
|
|
141
|
+
sa.Column("baseline_id", sa.String(length=64), nullable=False),
|
|
142
|
+
sa.Column("metric_rule_version", sa.String(length=40), nullable=False),
|
|
143
|
+
sa.Column("threshold_version", sa.String(length=40), nullable=False),
|
|
144
|
+
sa.Column("content_hash", sa.String(length=64), nullable=False),
|
|
145
|
+
sa.Column("result_json", sa.Text(), nullable=False),
|
|
146
|
+
sa.Column(
|
|
147
|
+
"created_at",
|
|
148
|
+
sa.DateTime(timezone=True),
|
|
149
|
+
server_default=sa.func.now(),
|
|
150
|
+
nullable=False,
|
|
151
|
+
),
|
|
152
|
+
sa.ForeignKeyConstraint(
|
|
153
|
+
["baseline_id"], ["structural_baselines.id"], ondelete="CASCADE"
|
|
154
|
+
),
|
|
155
|
+
sa.PrimaryKeyConstraint("baseline_id", "metric_rule_version", "threshold_version"),
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def downgrade() -> None:
|
|
160
|
+
op.drop_table("structural_materializations")
|
|
161
|
+
op.drop_table("structural_edge_counts")
|
|
162
|
+
op.drop_table("structural_file_counts")
|
|
163
|
+
op.drop_index("ix_structural_baselines_repository_status", table_name="structural_baselines")
|
|
164
|
+
op.drop_table("structural_baselines")
|
|
165
|
+
op.drop_index(
|
|
166
|
+
"ix_structural_edge_occurrences_paths", table_name="structural_edge_occurrences"
|
|
167
|
+
)
|
|
168
|
+
op.drop_table("structural_edge_occurrences")
|
|
169
|
+
op.drop_index(
|
|
170
|
+
"ix_structural_file_occurrences_path", table_name="structural_file_occurrences"
|
|
171
|
+
)
|
|
172
|
+
op.drop_table("structural_file_occurrences")
|
|
173
|
+
op.drop_table("structural_commit_facts")
|