Databases
Multiple databases
One proxy can front several Postgres databases, including databases on different servers. The client picks the database with the startup parameter, which is the database name in the URL. One process, one port.
Add a database
tablebelt init still writes a single database. tablebelt add blog adds another one to the same tablebelt.yaml and prints that database's DATABASE_URL. Give the agent that URL. The upstream DSN stays on the proxy host.
tablebelt init
tablebelt add blog
tablebelt databases
tablebelt run
tablebelt databases lists them. Each entry has its own agent credential. In the example below, shop reads .tablebelt/shop.agent.password and blog reads .tablebelt/blog.agent.password.
Config
Each entry inherits the global hold, snapshots and rules sections. Set a field on the entry to override it. The upstream DSN does not inherit. A config with no databases map is still one database named database.name, so existing installs keep working.
databases:
shop:
upstream:
dsn_env: TABLEBELT_UPSTREAM_DSN_SHOP
users:
- name: shop
password_file: .tablebelt/shop.agent.password
blog:
upstream:
dsn_env: TABLEBELT_UPSTREAM_DSN_BLOG
snapshots:
schema: tablebelt
hold:
max_pending: 20
rules:
protected_schemas:
- tablebelt
- audit
users:
- name: blog
password_file: .tablebelt/blog.agent.password
shop inherits hold, snapshots and rules. blog overrides snapshots.schema, hold.max_pending and rules.protected_schemas. Put each upstream DSN in the environment variable named by that entry. The single-database reference is on Config.
Commands
tablebelt status, holds, approve, deny, restore, snapshots and doctor accept --db shop. When a hold id exists on more than one database, the CLI shows shop/hold_0003.
tablebelt status --db shop
tablebelt holds --db blog
Reload and remove
A database whose upstream is down refuses new connections. The others keep serving. tablebelt reload (or SIGHUP) picks up an added or removed database without dropping sessions on the databases that did not change.
tablebelt remove blog drops it from the config and leaves the tablebelt schema in place. The last database cannot be removed.
Plans
Free mode still makes no outbound calls, and there is no limit on local databases. Pro is $19 per database per month. Team is $79 per month for up to 10 databases. On a paid plan, a database that is not covered uses local approvals. The client sees: database blog is not on your plan; add it in the dashboard.