From e465acdd732ab7486b521cc75713b0ce4c4cbec0 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 26 Apr 2022 12:57:41 +0200 Subject: [PATCH] Add index on news --- .../versions/af77ca6a89d0_news_index.py | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 migrations/versions/af77ca6a89d0_news_index.py diff --git a/migrations/versions/af77ca6a89d0_news_index.py b/migrations/versions/af77ca6a89d0_news_index.py new file mode 100644 index 00000000..3af1fb41 --- /dev/null +++ b/migrations/versions/af77ca6a89d0_news_index.py @@ -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 ###