mirror of
https://github.com/simple-login/app.git
synced 2025-09-21 14:04:26 +08:00
chore: add missing index for job (#2450)
This commit is contained in:
parent
c1e72bb460
commit
46b42042db
2 changed files with 37 additions and 1 deletions
|
@ -2828,7 +2828,14 @@ class Job(Base, ModelMixin):
|
||||||
)
|
)
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
Index("ix_state_run_at_taken_at_priority", state, run_at, taken_at, priority),
|
Index(
|
||||||
|
"ix_state_run_at_taken_at_priority_attempts",
|
||||||
|
state,
|
||||||
|
run_at,
|
||||||
|
taken_at,
|
||||||
|
priority,
|
||||||
|
attempts,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
"""Job missing index
|
||||||
|
|
||||||
|
Revision ID: 51a061fd6ef0
|
||||||
|
Revises: 07855f9f39b1
|
||||||
|
Create Date: 2025-05-05 11:06:43.058096
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '51a061fd6ef0'
|
||||||
|
down_revision = '07855f9f39b1'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
with op.get_context().autocommit_block():
|
||||||
|
op.create_index('ix_state_run_at_taken_at_priority_attempts', 'job', ['state', 'run_at', 'taken_at', 'priority', 'attempts'], unique=False, postgresql_concurrently=True)
|
||||||
|
op.drop_index('ix_state_run_at_taken_at_priority', table_name='job', postgresql_concurrently=True)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
with op.get_context().autocommit_block():
|
||||||
|
op.create_index('ix_state_run_at_taken_at_priority', 'job', ['state', 'run_at', 'taken_at', 'priority'], unique=False, postgresql_concurrently=True)
|
||||||
|
op.drop_index('ix_state_run_at_taken_at_priority_attempts', table_name='job', postgresql_concurrently=True)
|
Loading…
Add table
Reference in a new issue