"""NIKAME GENERATED migration

Revision ID: {{ revision_id }}
Revises: {{ previous_revision }}
Create Date: {{ date }}

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '{{ revision_id }}'
down_revision: Union[str, None] = '{{ previous_revision }}'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # NIKAME GENERATED: Skeleton upgrade - use alembic revision --autogenerate for full sync
    {% for table in tables %}
    op.create_table(
        '{{ table.name }}',
        {% for col in table.columns %}
        sa.Column('{{ col.name }}', sa.{{ col.type }}, nullable={{ col.nullable }}, primary_key={{ col.primary_key }}),
        {% endfor %}
    )
    {% endfor %}


def downgrade() -> None:
    {% for table in tables %}
    op.drop_table('{{ table.name }}')
    {% endfor %}
