Switch to batch operations for SQL migration
This commit is contained in:
parent
8e8535cbe9
commit
63ed03785b
|
@ -14,13 +14,15 @@ from alembic import op
|
|||
import sqlalchemy as sa
|
||||
|
||||
def upgrade():
|
||||
op.add_column('ps_transports', sa.Column('tcp_keepalive_enable', sa.Boolean(), nullable=True))
|
||||
op.add_column('ps_transports', sa.Column('tcp_keepalive_idle_time', sa.Integer(), nullable=True))
|
||||
op.add_column('ps_transports', sa.Column('tcp_keepalive_interval_time', sa.Integer(), nullable=True))
|
||||
op.add_column('ps_transports', sa.Column('tcp_keepalive_probe_count', sa.Integer(), nullable=True))
|
||||
with op.batch_alter_table('ps_transports') as batch_op:
|
||||
batch_op.add_column(sa.Column('tcp_keepalive_enable', sa.Boolean(), nullable=True))
|
||||
batch_op.add_column(sa.Column('tcp_keepalive_idle_time', sa.Integer(), nullable=True))
|
||||
batch_op.add_column(sa.Column('tcp_keepalive_interval_time', sa.Integer(), nullable=True))
|
||||
batch_op.add_column(sa.Column('tcp_keepalive_probe_count', sa.Integer(), nullable=True))
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('ps_transports', 'tcp_keepalive_enable')
|
||||
op.drop_column('ps_transports', 'tcp_keepalive_idle_time')
|
||||
op.drop_column('ps_transports', 'tcp_keepalive_interval_time')
|
||||
op.drop_column('ps_transports', 'tcp_keepalive_probe_count')
|
||||
with op.batch_alter_table('ps_transports') as batch_op:
|
||||
batch_op.drop_column('tcp_keepalive_enable')
|
||||
batch_op.drop_column('tcp_keepalive_idle_time')
|
||||
batch_op.drop_column('tcp_keepalive_interval_time')
|
||||
batch_op.drop_column('tcp_keepalive_probe_count')
|
||||
|
|
Loading…
Reference in New Issue