"""tokenbalance

Revision ID: 6dec2ce1e11c
Revises: 
Create Date: 2021-04-06 15:41:14.955507

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

# revision identifiers, used by Alembic.
revision = "6dec2ce1e11c"
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "snapshots",
        sa.Column("row_id", sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column(
            "row_created",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column(
            "row_updated",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column("address", sa.VARCHAR(length=50), nullable=False),
        sa.Column("block_number", sa.BIGINT(), nullable=False),
        sa.Column("balance_in_cogs", sa.BIGINT(), nullable=False),
        sa.Column("snapshot_date", mysql.TIMESTAMP(), nullable=False),
        sa.PrimaryKeyConstraint("row_id"),
    )
    op.create_index(
        op.f("ix_snapshots_address"), "snapshots", ["address"], unique=False
    )
    op.create_table(
        "transfer_info",
        sa.Column("row_id", sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column(
            "row_created",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column(
            "row_updated",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column("wallet_address", sa.VARCHAR(length=50), nullable=False),
        sa.Column("transfer_time", mysql.TIMESTAMP(), nullable=False),
        sa.Column("transfer_fees", sa.BIGINT(), nullable=False),
        sa.Column("transfer_transaction", sa.VARCHAR(length=255), nullable=False),
        sa.Column("transfer_amount_in_cogs", sa.BIGINT(), nullable=False),
        sa.Column("transfer_status", sa.VARCHAR(length=50), nullable=False),
        sa.Column("address_type", sa.INTEGER(), nullable=False),
        sa.PrimaryKeyConstraint("row_id"),
    )
    op.create_index(
        op.f("ix_transfer_info_wallet_address"),
        "transfer_info",
        ["wallet_address"],
        unique=False,
    )
    op.create_table(
        "user_access_details",
        sa.Column("row_id", sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column(
            "row_created",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column(
            "row_updated",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column("wallet_address", sa.VARCHAR(length=50), nullable=False),
        sa.Column("email", sa.VARCHAR(length=120), nullable=False),
        sa.Column("name", sa.VARCHAR(length=60), nullable=True),
        sa.Column("login_time", mysql.TIMESTAMP(), nullable=False),
        sa.PrimaryKeyConstraint("row_id"),
    )
    op.create_index(
        op.f("ix_user_access_details_wallet_address"),
        "user_access_details",
        ["wallet_address"],
        unique=False,
    )
    op.create_table(
        "user_comments",
        sa.Column("row_id", sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column(
            "row_created",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column(
            "row_updated",
            mysql.TIMESTAMP(),
            server_default=sa.text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column("wallet_address", sa.VARCHAR(length=50), nullable=False),
        sa.Column("comment", sa.TEXT(), nullable=False),
        sa.PrimaryKeyConstraint("row_id"),
    )
    op.create_index(
        op.f("ix_user_comments_wallet_address"),
        "user_comments",
        ["wallet_address"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_user_comments_wallet_address"), table_name="user_comments")
    op.drop_table("user_comments")
    op.drop_index(
        op.f("ix_user_access_details_wallet_address"), table_name="user_access_details"
    )
    op.drop_table("user_access_details")
    op.drop_index(op.f("ix_transfer_info_wallet_address"), table_name="transfer_info")
    op.drop_table("transfer_info")
    op.drop_index(op.f("ix_snapshots_address"), table_name="snapshots")
    op.drop_table("snapshots")
    # ### end Alembic commands ###
