"""Add rtp_task_resource_record table

Revision ID: 3d3c72ecbc0d
Revises: c9a1ff35c6ed
Create Date: 2018-01-20 21:35:16.716477+00:00

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "3d3c72ecbc0d"
down_revision = "c9a1ff35c6ed"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "rtp_task_resource_record",
        sa.Column("obsid", sa.BigInteger(), nullable=False),
        sa.Column("task_name", sa.Text(), nullable=False),
        sa.Column("start_time", sa.BigInteger(), nullable=False),
        sa.Column("stop_time", sa.BigInteger(), nullable=False),
        sa.Column("max_memory", sa.Float(), nullable=True),
        sa.Column("avg_cpu_load", sa.Float(), nullable=True),
        sa.ForeignKeyConstraint(
            ["obsid"],
            ["hera_obs.obsid"],
        ),
        sa.PrimaryKeyConstraint("obsid", "task_name"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("rtp_task_resource_record")
    # ### end Alembic commands ###
