1 | 'use strict'
|
2 |
|
3 | const cli = require('heroku-cli-util')
|
4 |
|
5 | async function run(context, heroku) {
|
6 | const fetcher = require('../lib/fetcher')(heroku)
|
7 | const host = require('../lib/host')
|
8 |
|
9 | await cli.action('Terminating connections for all credentials', async function () {
|
10 | const db = await fetcher.addon(context.app, context.args.database)
|
11 | await heroku.post(`/client/v11/databases/${db.id}/connection_reset`, { host: host(db) })
|
12 | }())
|
13 | }
|
14 |
|
15 | module.exports = {
|
16 | topic: 'pg',
|
17 | command: 'killall',
|
18 | description: 'terminates all connections for all credentials',
|
19 | needsApp: true,
|
20 | needsAuth: true,
|
21 | args: [{ name: 'database', optional: true }],
|
22 | run: cli.command({ preauth: true }, run)
|
23 | }
|