Merge pull request #2225 from charltonaustin/adding_in_new_indices
Adding in new indices for queueitem table.
This commit is contained in:
commit
8ca8c17e27
3 changed files with 50 additions and 4 deletions
|
@ -758,15 +758,21 @@ class BUILD_PHASE(object):
|
|||
class QueueItem(BaseModel):
|
||||
queue_name = CharField(index=True, max_length=1024)
|
||||
body = TextField()
|
||||
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, index=True)
|
||||
available_after = DateTimeField(default=datetime.utcnow)
|
||||
available = BooleanField(default=True)
|
||||
processing_expires = DateTimeField(null=True)
|
||||
retries_remaining = IntegerField(default=5)
|
||||
|
||||
class Meta:
|
||||
database = db
|
||||
read_slaves = (read_slave,)
|
||||
only_save_dirty = True
|
||||
indexes = (
|
||||
(('processing_expires', 'available'), False),
|
||||
(('processing_expires', 'queue_name', 'available'), False),
|
||||
(('processing_expires', 'available_after', 'retries_remaining', 'available'), False),
|
||||
(('processing_expires', 'available_after', 'queue_name', 'retries_remaining', 'available'), False),
|
||||
)
|
||||
|
||||
|
||||
class RepositoryBuild(BaseModel):
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
"""update queue item table indices
|
||||
|
||||
Revision ID: f5167870dd66
|
||||
Revises: 45fd8b9869d4
|
||||
Create Date: 2016-12-08 17:26:20.333846
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f5167870dd66'
|
||||
down_revision = '45fd8b9869d4'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('queueitem_processing_expires_available', 'queueitem', ['processing_expires', 'available'], unique=False)
|
||||
op.create_index('queueitem_pe_aafter_qname_rremaining_available', 'queueitem', ['processing_expires', 'available_after', 'queue_name', 'retries_remaining', 'available'], unique=False)
|
||||
op.create_index('queueitem_pexpires_aafter_rremaining_available', 'queueitem', ['processing_expires', 'available_after', 'retries_remaining', 'available'], unique=False)
|
||||
op.create_index('queueitem_processing_expires_queue_name_available', 'queueitem', ['processing_expires', 'queue_name', 'available'], unique=False)
|
||||
op.drop_index('queueitem_available', table_name='queueitem')
|
||||
op.drop_index('queueitem_available_after', table_name='queueitem')
|
||||
op.drop_index('queueitem_processing_expires', table_name='queueitem')
|
||||
op.drop_index('queueitem_retries_remaining', table_name='queueitem')
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('queueitem_retries_remaining', 'queueitem', ['retries_remaining'], unique=False)
|
||||
op.create_index('queueitem_processing_expires', 'queueitem', ['processing_expires'], unique=False)
|
||||
op.create_index('queueitem_available_after', 'queueitem', ['available_after'], unique=False)
|
||||
op.create_index('queueitem_available', 'queueitem', ['available'], unique=False)
|
||||
op.drop_index('queueitem_processing_expires_queue_name_available', table_name='queueitem')
|
||||
op.drop_index('queueitem_pexpires_aafter_rremaining_available', table_name='queueitem')
|
||||
op.drop_index('queueitem_pe_aafter_qname_rremaining_available', table_name='queueitem')
|
||||
op.drop_index('queueitem_processing_expires_available', table_name='queueitem')
|
||||
### end Alembic commands ###
|
Binary file not shown.
Reference in a new issue