diff --git a/data/database.py b/data/database.py index 80e47bf2e..225b0c11c 100644 --- a/data/database.py +++ b/data/database.py @@ -606,7 +606,7 @@ class QueueItem(BaseModel): available_after = DateTimeField(default=datetime.utcnow, index=True) available = BooleanField(default=True, index=True) processing_expires = DateTimeField(null=True, index=True) - retries_remaining = IntegerField(default=5) + retries_remaining = IntegerField(default=5, index=True) class RepositoryBuild(BaseModel): diff --git a/data/migrations/versions/246df01a6d51_add_index_to_retries_remaining.py b/data/migrations/versions/246df01a6d51_add_index_to_retries_remaining.py new file mode 100644 index 000000000..41488b17b --- /dev/null +++ b/data/migrations/versions/246df01a6d51_add_index_to_retries_remaining.py @@ -0,0 +1,26 @@ +"""Add index to retries_remaining + +Revision ID: 246df01a6d51 +Revises: 5232a5610a0a +Create Date: 2015-08-04 17:59:42.262877 + +""" + +# revision identifiers, used by Alembic. +revision = '246df01a6d51' +down_revision = '5232a5610a0a' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(tables): + ### commands auto generated by Alembic - please adjust! ### + op.create_index('queueitem_retries_remaining', 'queueitem', ['retries_remaining'], unique=False) + ### end Alembic commands ### + + +def downgrade(tables): + ### commands auto generated by Alembic - please adjust! ### + op.drop_index('queueitem_retries_remaining', table_name='queueitem') + ### end Alembic commands ###