Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions collectoss/application/db/models/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,8 @@ class Issue(Base):
Index("issues_ibfk_1", "repo_id"),
Index("issues_ibfk_2", "reporter_id"),
Index("issues_ibfk_4", "pull_request_id"),
Index("issues_idx_repo_id_updated_at", "repo_id", "updated_at"),
Index("issues_idx_repo_id_created_at", "repo_id", "created_at"),

UniqueConstraint("repo_id", "gh_issue_id"),
UniqueConstraint("issue_url", name="issue-insert-unique"),
Expand Down Expand Up @@ -1747,6 +1749,8 @@ class PullRequest(Base):
Index(
"pull_requests_idx_repo_id_data_datex", "repo_id", "data_collection_date"
),
Index("pull_requests_idx_repo_id_pr_updated_at", "repo_id", "pr_updated_at"),
Index("pull_requests_idx_repo_id_pr_created_at", "repo_id", "pr_created_at"),
Index("pr_ID_prs_table", "pull_request_id"),
{"schema": "data"},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""add issue and pull request activity indexes

Revision ID: 45
Revises: 44

"""
from alembic import op

# revision identifiers, used by Alembic.
revision = '45'
down_revision = '44'
branch_labels = None
depends_on = None


def upgrade():
# Concurrent builds keep these tables writable during collection.
with op.get_context().autocommit_block():
op.create_index(
'issues_idx_repo_id_updated_at', 'issues', ['repo_id', 'updated_at'],
schema='data', postgresql_concurrently=True,
Comment on lines +18 to +21

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this migration generated with an AI tool, or alembic's built-in --autogenerate flag?

)
op.create_index(
'issues_idx_repo_id_created_at', 'issues', ['repo_id', 'created_at'],
schema='data', postgresql_concurrently=True,
)
op.create_index(
'pull_requests_idx_repo_id_pr_updated_at', 'pull_requests',
['repo_id', 'pr_updated_at'],
schema='data', postgresql_concurrently=True,
)
op.create_index(
'pull_requests_idx_repo_id_pr_created_at', 'pull_requests',
['repo_id', 'pr_created_at'],
schema='data', postgresql_concurrently=True,
)


def downgrade():
with op.get_context().autocommit_block():
op.drop_index(
'pull_requests_idx_repo_id_pr_created_at', table_name='pull_requests',
schema='data', postgresql_concurrently=True,
)
op.drop_index(
'pull_requests_idx_repo_id_pr_updated_at', table_name='pull_requests',
schema='data', postgresql_concurrently=True,
)
op.drop_index(
'issues_idx_repo_id_created_at', table_name='issues',
schema='data', postgresql_concurrently=True,
)
op.drop_index(
'issues_idx_repo_id_updated_at', table_name='issues',
schema='data', postgresql_concurrently=True,
)
Loading