|
| 1 | +"""Add ix_fleets_pipeline_fetch_q index |
| 2 | +
|
| 3 | +Revision ID: 46150101edec |
| 4 | +Revises: d21d3e61de27 |
| 5 | +Create Date: 2026-03-02 05:30:07.196407+00:00 |
| 6 | +
|
| 7 | +""" |
| 8 | + |
| 9 | +import sqlalchemy as sa |
| 10 | +from alembic import op |
| 11 | + |
| 12 | +# revision identifiers, used by Alembic. |
| 13 | +revision = "46150101edec" |
| 14 | +down_revision = "d21d3e61de27" |
| 15 | +branch_labels = None |
| 16 | +depends_on = None |
| 17 | + |
| 18 | + |
| 19 | +def upgrade() -> None: |
| 20 | + # ### commands auto generated by Alembic - please adjust! ### |
| 21 | + with op.get_context().autocommit_block(): |
| 22 | + op.drop_index( |
| 23 | + "ix_fleets_pipeline_fetch_q", |
| 24 | + table_name="fleets", |
| 25 | + if_exists=True, |
| 26 | + postgresql_concurrently=True, |
| 27 | + ) |
| 28 | + op.create_index( |
| 29 | + "ix_fleets_pipeline_fetch_q", |
| 30 | + "fleets", |
| 31 | + [sa.literal_column("last_processed_at ASC")], |
| 32 | + unique=False, |
| 33 | + sqlite_where=sa.text("deleted = 0"), |
| 34 | + postgresql_where=sa.text("deleted IS FALSE"), |
| 35 | + postgresql_concurrently=True, |
| 36 | + ) |
| 37 | + # ### end Alembic commands ### |
| 38 | + |
| 39 | + |
| 40 | +def downgrade() -> None: |
| 41 | + # ### commands auto generated by Alembic - please adjust! ### |
| 42 | + with op.get_context().autocommit_block(): |
| 43 | + op.drop_index( |
| 44 | + "ix_fleets_pipeline_fetch_q", |
| 45 | + table_name="fleets", |
| 46 | + if_exists=True, |
| 47 | + postgresql_concurrently=True, |
| 48 | + ) |
| 49 | + # ### end Alembic commands ### |
0 commit comments