"""add_pbdb_taxon_to_taxa

Revision ID: d24dd23aad7a
Revises: 8b21130270e5
Create Date: 2021-01-25 07:44:24.207592

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

# revision identifiers, used by Alembic.
revision = "d24dd23aad7a"
down_revision = "8b21130270e5"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "taxa",
        sa.Column("pbdb_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    )
    op.add_column("taxa", sa.Column("pbdb_notes", sa.String(), nullable=True))
    op.add_column("taxa", sa.Column("pbdb_taxon_id", sa.Integer(), nullable=True))
    op.add_column("taxa", sa.Column("pbdb_taxon_name", sa.String(), nullable=True))
    op.add_column("taxa", sa.Column("pbdb_accepted_name", sa.String(), nullable=True))
    op.add_column("taxa", sa.Column("pbdb_taxon_rank", sa.String(), nullable=True))
    op.add_column("taxa", sa.Column("pbdb_accepted_rank", sa.String(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("taxa", "pbdb_accepted_rank")
    op.drop_column("taxa", "pbdb_taxon_rank")
    op.drop_column("taxa", "pbdb_accepted_name")
    op.drop_column("taxa", "pbdb_taxon_name")
    op.drop_column("taxa", "pbdb_taxon_id")
    op.drop_column("taxa", "pbdb_notes")
    op.drop_column("taxa", "pbdb_data")
    # ### end Alembic commands ###
