"""empty message

Revision ID: 0a59d3b73f1e
Revises: d1acbda1caf6
Create Date: 2019-11-19 23:12:42.697407

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '0a59d3b73f1e'
down_revision = 'd1acbda1caf6'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('stat',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('action', sa.String(length=56), nullable=False),
    sa.Column('date', sa.DateTime(), nullable=True),
    sa.Column('chat_id', sa.Integer(), nullable=False),
    sa.Column('meta', sa.JSON(), nullable=False),
    sa.ForeignKeyConstraint(['chat_id'], ['user_chat.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('statistic')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('statistic',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('action', sa.VARCHAR(length=14), autoincrement=False, nullable=False),
    sa.Column('date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('chat_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('meta', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False),
    sa.CheckConstraint("(action)::text = ANY ((ARRAY['_default'::character varying, 'start'::character varying, 'unsubscribe'::character varying, 'city_added'::character varying, 'position_added'::character varying])::text[])", name='action'),
    sa.ForeignKeyConstraint(['chat_id'], ['user_chat.id'], name='statistic_chat_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='statistic_pkey')
    )
    op.drop_table('stat')
    # ### end Alembic commands ###
