Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Add projects.original_name

Revision ID: 006512f572b4
Revises: 06e977bc61c7
Create Date: 2025-11-27 15:11:21.249079

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "006512f572b4"
down_revision = "06e977bc61c7"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# For postgres, this was moved from a previous migration to avoid deadlocks.
# Keep SQLite in previous migration since it doesn't have deadlock issues and
# does not support if_not_exists.
if op.get_context().dialect.name != "sqlite":
with op.batch_alter_table("projects", schema=None) as batch_op:
batch_op.add_column(
sa.Column("original_name", sa.String(length=50), nullable=True),
if_not_exists=True,
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
if op.get_context().dialect.name != "sqlite":
with op.batch_alter_table("projects", schema=None) as batch_op:
batch_op.drop_column("original_name")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def upgrade() -> None:
)
batch_op.add_column(sa.Column("original_name", sa.String(length=50), nullable=True))

with op.batch_alter_table("projects", schema=None) as batch_op:
batch_op.add_column(sa.Column("original_name", sa.String(length=50), nullable=True))
# For postgres, this was moved to a new migration to avoid deadlocks.
if op.get_context().dialect.name == "sqlite":
with op.batch_alter_table("projects", schema=None) as batch_op:
batch_op.add_column(sa.Column("original_name", sa.String(length=50), nullable=True))
# ### end Alembic commands ###


Expand All @@ -35,7 +37,9 @@ def downgrade() -> None:
batch_op.drop_column("original_name")
batch_op.drop_column("deleted")

with op.batch_alter_table("projects", schema=None) as batch_op:
batch_op.drop_column("original_name")
# For postgres, this was moved to a new migration to avoid deadlocks.
if op.get_context().dialect.name == "sqlite":
with op.batch_alter_table("projects", schema=None) as batch_op:
batch_op.drop_column("original_name")

# ### end Alembic commands ###