mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-30 00:27:11 +09:00
An installed PostgreSQL can switch on a transaction-mode PgBouncer sidecar through its managed override, with no host port, on the shared network. fromService gains pooledUrl; apps keep the direct connectionString unless they switch, because transaction pooling breaks prepared statements in some drivers, LISTEN and advisory locks, and the card says so.
20 lines
620 B
Python
20 lines
620 B
Python
"""Opt-in PgBouncer per PostgreSQL app (plan 86 §D1). NULL = off."""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = '103_pooler_enabled'
|
|
down_revision = '102_app_attachments'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
inspector = sa.inspect(op.get_bind())
|
|
# Add-if-missing: the pre-alembic schema sync may already have added it.
|
|
if 'pooler_enabled' not in {c['name'] for c in inspector.get_columns('applications')}:
|
|
op.add_column('applications', sa.Column('pooler_enabled', sa.Boolean, nullable=True))
|
|
|
|
|
|
def downgrade():
|
|
op.drop_column('applications', 'pooler_enabled')
|