UNPKG

788 BJavaScriptView Raw
1'use strict'
2
3const cli = require('heroku-cli-util')
4
5async function run(context, heroku) {
6 const fetcher = require('../../lib/fetcher')(heroku)
7 const host = require('../../lib/host')
8 const util = require('../../lib/util')
9 const { app, args } = context
10 const db = await fetcher.addon(app, args.database)
11
12 if (util.starterPlan(db)) throw new Error('pg:maintenance is only available for production databases')
13 let info = await heroku.get(`/client/v11/databases/${db.id}/maintenance`, { host: host(db) })
14 cli.log(info.message)
15}
16
17module.exports = {
18 topic: 'pg',
19 command: 'maintenance',
20 description: 'show current maintenance information',
21 needsApp: true,
22 needsAuth: true,
23 args: [{ name: 'database', optional: true }],
24 run: cli.command({ preauth: true }, run)
25}