Add indexes and pagination to improve app performance
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
"""Add reading index and profile updated_at
|
||||
|
||||
Revision ID: 8cfe56a1e597
|
||||
Revises: 5e5a1b78b966
|
||||
Create Date: 2026-03-09 21:21:44.291659
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8cfe56a1e597'
|
||||
down_revision = '5e5a1b78b966'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('profile', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('updated_at', sa.DateTime(), nullable=True))
|
||||
|
||||
with op.batch_alter_table('reading', schema=None) as batch_op:
|
||||
batch_op.create_index('ix_reading_user_timestamp', ['user_id', 'timestamp'], unique=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('reading', schema=None) as batch_op:
|
||||
batch_op.drop_index('ix_reading_user_timestamp')
|
||||
|
||||
with op.batch_alter_table('profile', schema=None) as batch_op:
|
||||
batch_op.drop_column('updated_at')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user