Add index on news

This commit is contained in:
Emmanuel Viennet 2022-04-26 12:57:41 +02:00
parent d000e7b5a7
commit e465acdd73

View File

@ -0,0 +1,41 @@
"""news index
Revision ID: af77ca6a89d0
Revises: e97b2a10f86c
Create Date: 2022-04-26 12:56:22.862451
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "af77ca6a89d0"
down_revision = "e97b2a10f86c"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_index(
op.f("ix_scolar_news_authenticated_user"),
"scolar_news",
["authenticated_user"],
unique=False,
)
op.create_index(op.f("ix_scolar_news_date"), "scolar_news", ["date"], unique=False)
op.create_index(
op.f("ix_scolar_news_object"), "scolar_news", ["object"], unique=False
)
op.create_index(op.f("ix_scolar_news_type"), "scolar_news", ["type"], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_scolar_news_type"), table_name="scolar_news")
op.drop_index(op.f("ix_scolar_news_object"), table_name="scolar_news")
op.drop_index(op.f("ix_scolar_news_date"), table_name="scolar_news")
op.drop_index(op.f("ix_scolar_news_authenticated_user"), table_name="scolar_news")
# ### end Alembic commands ###