Skip to content

Commit

Permalink
fix: perform missing alter column in migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed May 9, 2024
1 parent 604aa9a commit 24dfca2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def upgrade():
);
"""
)
op.execute("UPDATE kernels SET status_history = '[]'::jsonb WHERE status_history IS NULL;")
op.alter_column("kernels", "status_history", nullable=False, default=[])

op.execute(
"""
Expand All @@ -53,6 +55,8 @@ def upgrade():
);
"""
)
op.execute("UPDATE sessions SET status_history = '[]'::jsonb WHERE status_history IS NULL;")
op.alter_column("sessions", "status_history", nullable=False, default=[])


def downgrade():
Expand All @@ -73,6 +77,8 @@ def downgrade():
WHERE data.id = kernels.id;
"""
)
op.alter_column("kernels", "status_history", nullable=True, default=None)
op.execute("UPDATE kernels SET status_history = NULL WHERE status_history = '[]'::jsonb;")

op.execute(
"""
Expand All @@ -91,3 +97,5 @@ def downgrade():
WHERE data.id = sessions.id;
"""
)
op.alter_column("sessions", "status_history", nullable=True, default=None)
op.execute("UPDATE sessions SET status_history = NULL WHERE status_history = '[]'::jsonb;")

0 comments on commit 24dfca2

Please sign in to comment.