Skip to content

Commit

Permalink
nullable_col
Browse files Browse the repository at this point in the history
  • Loading branch information
parfenovma committed Aug 30, 2024
1 parent a6e5857 commit f0ce055
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""change to nullable events_id
Revision ID: f9426dfd57e2
Revises: eba63ac1dd15
Create Date: 2024-08-30 16:17:30.062783
"""

import os

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = 'f9426dfd57e2'
down_revision = 'eba63ac1dd15'
branch_labels = None
depends_on = None


def upgrade():
op.alter_column(
'diff', 'events_id', existing_type=postgresql.ARRAY(sa.INTEGER()), nullable=True, schema='STG_RASPHYSMSU'
)
op.alter_column(
'new', 'events_id', existing_type=postgresql.ARRAY(sa.INTEGER()), nullable=True, schema='STG_RASPHYSMSU'
)
op.alter_column(
'old', 'events_id', existing_type=postgresql.ARRAY(sa.INTEGER()), nullable=True, schema='STG_RASPHYSMSU'
)


def downgrade():
op.alter_column(
'old', 'events_id', existing_type=postgresql.ARRAY(sa.INTEGER()), nullable=False, schema='STG_RASPHYSMSU'
)
op.alter_column(
'new', 'events_id', existing_type=postgresql.ARRAY(sa.INTEGER()), nullable=False, schema='STG_RASPHYSMSU'
)
op.alter_column(
'diff', 'events_id', existing_type=postgresql.ARRAY(sa.INTEGER()), nullable=False, schema='STG_RASPHYSMSU'
)
6 changes: 3 additions & 3 deletions profcomff_definitions/STG/rasphysmsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Diff(Base):
place: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
group: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
teacher: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
events_id: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
events_id: Mapped[tp.List[int] | None] = mapped_column(ARRAY(Integer))
action: Mapped[str | None]


Expand All @@ -44,7 +44,7 @@ class Old(Base):
place: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
group: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
teacher: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
events_id: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
events_id: Mapped[tp.List[int] | None] = mapped_column(ARRAY(Integer))


class New(Base):
Expand All @@ -59,4 +59,4 @@ class New(Base):
place: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
group: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
teacher: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
events_id: Mapped[tp.List[int]] = mapped_column(ARRAY(Integer))
events_id: Mapped[tp.List[int] | None] = mapped_column(ARRAY(Integer))

0 comments on commit f0ce055

Please sign in to comment.