"""add box and line analytics tables

Revision ID: 71f62e961e40
Revises:
Create Date: 2023-06-08 12:40:57.585706

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

# revision identifiers, used by Alembic.
revision = '71f62e961e40'
down_revision = None
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'box_analytics',
        sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
        sa.Column('saved', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
        sa.Column('box_id', sa.Integer(), nullable=False),
        sa.Column('time_spent_in', mysql.DOUBLE(asdecimal=True), nullable=False),
        sa.PrimaryKeyConstraint('id'),
    )
    op.create_table(
        'line_analytics',
        sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
        sa.Column('saved', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
        sa.Column('line_id', sa.Integer(), nullable=False),
        sa.Column('up', sa.Integer(), nullable=False),
        sa.Column('down', sa.Integer(), nullable=False),
        sa.PrimaryKeyConstraint('id'),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('line_analytics')
    op.drop_table('box_analytics')
    # ### end Alembic commands ###
