"""Point normalizer to raw file

Revision ID: 0008
Revises: 0007
Create Date: 2022-04-28 14:03:02.214129

"""

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

# revision identifiers, used by Alembic.
revision = "0008"
down_revision = "0007"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("normalizer_meta", sa.Column("raw_file_id", postgresql.UUID(), autoincrement=False, nullable=True))
    op.create_foreign_key(
        "normalizer_meta_raw_file_id_fkey", "normalizer_meta", "raw_file", ["raw_file_id"], ["id"], ondelete="CASCADE"
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint("normalizer_meta_raw_file_id_fkey", "normalizer_meta", type_="foreignkey")
    op.drop_column("normalizer_meta", "raw_file_id")
    # ### end Alembic commands ###
