"""database creation

Revision ID: 825d896d998a
Revises: 
Create Date: 2024-01-22 15:27:04.701809

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '825d896d998a'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('runs',
    sa.Column('id', sa.String(), nullable=False),
    sa.Column('deltatwin_id', sa.String(), nullable=False),
    sa.Column('deltatwin_version', sa.String(), nullable=False),
    sa.Column('owner', sa.String(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=False),
    sa.Column('status', sa.Enum('CREATED', 'RUNNING', 'SUCCEEDED', 'CANCELLED', 'ERROR', name='runstatus'), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('parameters',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('run_id', sa.String(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('param_type', sa.String(), nullable=False),
    sa.Column('type', sa.String(), nullable=False),
    sa.Column('kind', sa.Enum('INPUT', 'OUTPUT', name='parameterkind'), nullable=False),
    sa.Column('value', sa.String(), nullable=True),
    sa.Column('url', sa.String(), nullable=True),
    sa.Column('path', sa.String(), nullable=True),
    sa.Column('size', sa.Integer(), nullable=True),
    sa.Column('checksum', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['run_id'], ['runs.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


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