2022-10-20 05:48:41 -05:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2023-01-02 00:23:55 -06:00
|
|
|
# Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
2022-10-20 05:48:41 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
2019-11-25 21:34:41 -06:00
|
|
|
""" Update the default timeout to 10 seconds instead on 0.
|
|
|
|
0 indicates wait indefinitely which causes trouble when network connection
|
|
|
|
to server is lost.
|
|
|
|
|
|
|
|
Revision ID: aff1436e3c8c
|
|
|
|
Revises: a77a0932a568
|
|
|
|
Create Date: 2019-10-28 12:47:36.828709
|
|
|
|
|
|
|
|
"""
|
2022-10-20 05:48:41 -05:00
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
2019-11-25 21:34:41 -06:00
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = 'aff1436e3c8c'
|
|
|
|
down_revision = 'a77a0932a568'
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2022-10-20 05:48:41 -05:00
|
|
|
# get metadata from current connection
|
|
|
|
meta = sa.MetaData(bind=op.get_bind())
|
|
|
|
# define table representation
|
|
|
|
meta.reflect(only=('server',))
|
|
|
|
server_table = sa.Table('server', meta)
|
|
|
|
op.execute(
|
|
|
|
server_table.update().where(server_table.c.connect_timeout == 0 or
|
|
|
|
server_table.c.connect_timeout is None)
|
|
|
|
.values(connect_timeout=10)
|
2019-11-25 21:34:41 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2020-07-24 01:16:30 -05:00
|
|
|
# pgAdmin only upgrades, downgrade not implemented.
|
2019-11-25 21:34:41 -06:00
|
|
|
pass
|