Prepare ERP source for Gitea deployment
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""release_a_clients_engagement_mode
|
||||
|
||||
Revision ID: 20260414_release_a_clients
|
||||
Revises: 7f1c9b2d4a10
|
||||
Create Date: 2026-04-14
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "20260414_release_a_clients"
|
||||
down_revision = "7f1c9b2d4a10"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# engagement_mode column already exists from the earlier partial migration,
|
||||
# so do NOT add it again.
|
||||
|
||||
# Make partner_id nullable in a SQLite-safe way
|
||||
with op.batch_alter_table("clients") as batch_op:
|
||||
batch_op.alter_column(
|
||||
"partner_id",
|
||||
existing_type=sa.Integer(),
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
# Remove server default from engagement_mode if it exists
|
||||
with op.batch_alter_table("clients") as batch_op:
|
||||
batch_op.alter_column(
|
||||
"engagement_mode",
|
||||
existing_type=sa.String(length=32),
|
||||
server_default=None,
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Revert partner_id back to NOT NULL
|
||||
with op.batch_alter_table("clients") as batch_op:
|
||||
batch_op.alter_column(
|
||||
"partner_id",
|
||||
existing_type=sa.Integer(),
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
# Drop engagement_mode
|
||||
with op.batch_alter_table("clients") as batch_op:
|
||||
batch_op.drop_column("engagement_mode")
|
||||
Reference in New Issue
Block a user