"""add data_source_type to Sample

Revision ID: aa5e16a8a2c6
Revises: e273dbddc079
Create Date: 2020-06-08 23:47:27.674539

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker

Session = sessionmaker()

# revision identifiers, used by Alembic.
revision = "aa5e16a8a2c6"
down_revision = "e273dbddc079"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("samples", sa.Column("data_source_type", sa.String(), nullable=True))

    bind = op.get_bind()
    session = Session(bind=bind)
    session.execute("UPDATE samples set data_source_type = 'lithology csv';")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("samples", "data_source_type")
    # ### end Alembic commands ###
