"""empty message

Revision ID: 7b105c6e08bf
Revises: dddeceadde74
Create Date: 2020-12-30 17:38:19.511314

"""
import sqlalchemy as sa
import sqlalchemy_utils
from alembic import op

from project import dbtypes

# revision identifiers, used by Alembic.
revision = "7b105c6e08bf"
down_revision = "dddeceadde74"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(op.f("ix_eventdate_end"), "eventdate", ["end"], unique=False)
    op.create_index(op.f("ix_eventdate_start"), "eventdate", ["start"], unique=False)
    # ### end Alembic commands ###
    op.create_index(
        "idx_event_name",
        "event",
        [sa.text("to_tsvector('english', name)")],
        postgresql_using="gin",
    )
    op.create_index(
        "idx_event_description",
        "event",
        [sa.text("to_tsvector('english', description)")],
        postgresql_using="gin",
    )
    op.create_index(
        "idx_event_tags",
        "event",
        [sa.text("to_tsvector('english', tags)")],
        postgresql_using="gin",
    )


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_eventdate_start"), table_name="eventdate")
    op.drop_index(op.f("ix_eventdate_end"), table_name="eventdate")
    # ### end Alembic commands ###
    op.drop_index("idx_event_name")
    op.drop_index("idx_event_description")
    op.drop_index("idx_event_tags")
