"""Added index on user_tokens and new project table

Revision ID: f96a6f19d483
Revises: 967423dc584a
Create Date: 2020-01-03 00:31:48.491107

"""
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = "f96a6f19d483"
down_revision = "967423dc584a"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "projects",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column(
            "created_datetime_utc",
            sa.DateTime(),
            server_default=sa.text("(now() at time zone 'utc')"),
            nullable=False,
        ),
        sa.Column("deleted_datetime_utc", sa.DateTime(), nullable=True),
        sa.Column("name", sa.Text(), nullable=False),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_user_tokens_user_id"), "user_tokens", ["user_id"], unique=False
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_user_tokens_user_id"), table_name="user_tokens")
    op.drop_table("projects")
    # ### end Alembic commands ###
