mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
add index on parent_id
This commit is contained in:
parent
45d8b042a5
commit
1d093bfe8c
2 changed files with 33 additions and 1 deletions
|
@ -711,7 +711,7 @@ class PostReply(db.Model):
|
||||||
community_id = db.Column(db.Integer, db.ForeignKey('community.id'), index=True)
|
community_id = db.Column(db.Integer, db.ForeignKey('community.id'), index=True)
|
||||||
domain_id = db.Column(db.Integer, db.ForeignKey('domain.id'), index=True)
|
domain_id = db.Column(db.Integer, db.ForeignKey('domain.id'), index=True)
|
||||||
image_id = db.Column(db.Integer, db.ForeignKey('file.id'), index=True)
|
image_id = db.Column(db.Integer, db.ForeignKey('file.id'), index=True)
|
||||||
parent_id = db.Column(db.Integer)
|
parent_id = db.Column(db.Integer, index=True)
|
||||||
root_id = db.Column(db.Integer)
|
root_id = db.Column(db.Integer)
|
||||||
depth = db.Column(db.Integer, default=0)
|
depth = db.Column(db.Integer, default=0)
|
||||||
instance_id = db.Column(db.Integer, db.ForeignKey('instance.id'), index=True)
|
instance_id = db.Column(db.Integer, db.ForeignKey('instance.id'), index=True)
|
||||||
|
|
32
migrations/versions/d37fe77e043c_index_parent_id.py
Normal file
32
migrations/versions/d37fe77e043c_index_parent_id.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
"""index parent_id
|
||||||
|
|
||||||
|
Revision ID: d37fe77e043c
|
||||||
|
Revises: f19d761c216d
|
||||||
|
Create Date: 2024-02-09 15:14:13.274755
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'd37fe77e043c'
|
||||||
|
down_revision = 'f19d761c216d'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('post_reply', schema=None) as batch_op:
|
||||||
|
batch_op.create_index(batch_op.f('ix_post_reply_parent_id'), ['parent_id'], unique=False)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('post_reply', schema=None) as batch_op:
|
||||||
|
batch_op.drop_index(batch_op.f('ix_post_reply_parent_id'))
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in a new issue