From 557020a824c63de3f7e52073eec40eec1fde6c10 Mon Sep 17 00:00:00 2001 From: Nathan Rashleigh Date: Mon, 8 Apr 2024 17:01:53 +1000 Subject: [PATCH] migration --- ...159293e4f30_allow_vision_to_be_nullable.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 migrations/versions/9159293e4f30_allow_vision_to_be_nullable.py diff --git a/migrations/versions/9159293e4f30_allow_vision_to_be_nullable.py b/migrations/versions/9159293e4f30_allow_vision_to_be_nullable.py new file mode 100644 index 0000000..35f101f --- /dev/null +++ b/migrations/versions/9159293e4f30_allow_vision_to_be_nullable.py @@ -0,0 +1,36 @@ +"""allow vision to be nullable + +Revision ID: 9159293e4f30 +Revises: e04bee35feab +Create Date: 2024-04-08 10:50:21.447942 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision: str = '9159293e4f30' +down_revision: Union[str, None] = 'e04bee35feab' +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.alter_column('attachments', 'vision', + existing_type=postgresql.JSON(astext_type=sa.Text()), + nullable=True) + op.drop_column('attachments', 'attributes') + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('attachments', sa.Column('attributes', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False)) + op.alter_column('attachments', 'vision', + existing_type=postgresql.JSON(astext_type=sa.Text()), + nullable=False) + # ### end Alembic commands ###