Skip to content

Commit

Permalink
Merge pull request #196 from heroku/include-essential-tier-in-checks
Browse files Browse the repository at this point in the history
Essential-* plan names are also considered "starter"
  • Loading branch information
binarycleric authored Oct 10, 2023
2 parents fd933c2 + 35ae687 commit bffa1d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion commands/fdwsql.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function * run (context, heroku) {

const db = yield pg.fetcher(heroku).database(app, database)
const addon = yield pg.fetcher(heroku).addon(app, database)
yield util.ensureNonStarterPlan(addon)
yield util.ensureEssentialTierPlan(addon)
cli.log('CREATE EXTENSION IF NOT EXISTS postgres_fdw;')
cli.log(`DROP SERVER IF EXISTS ${prefix}_db;`)
cli.log(`CREATE SERVER ${prefix}_db
Expand Down
2 changes: 1 addition & 1 deletion commands/stats_reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function * run (context, heroku) {
const { database } = context.args

const db = yield pg.fetcher(heroku).addon(app, database)
yield util.ensureNonStarterPlan(db)
yield util.ensureEssentialTierPlan(db)
const host = pg.host(db)
const rsp = yield heroku.put(`/client/v11/databases/${db.name}/stats_reset`, { host })
cli.log(rsp.message)
Expand Down
2 changes: 1 addition & 1 deletion commands/user_connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function * run (context, heroku) {
const { database } = context.args

const db = yield pg.fetcher(heroku).addon(app, database)
yield util.ensureNonStarterPlan(db)
yield util.ensureEssentialTierPlan(db)
const host = pg.host(db)

const credentials = yield heroku.get(`/postgres/v0/databases/${db.name}/credentials`, { host: host })
Expand Down
8 changes: 4 additions & 4 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ You can install it by running:
}
}

function * ensureNonStarterPlan (db) {
if (db.plan.name.match(/(dev|basic)$/)) {
throw new Error('This operation is not supported by Hobby tier databases.')
function * ensureEssentialTierPlan (db) {
if (db.plan.name.match(/(dev|basic|essential-[0-9]+)$/)) {
throw new Error('This operation is not supported by Essential-tier databases.')
}
}

Expand All @@ -41,6 +41,6 @@ function * newTotalExecTimeField (db) {

module.exports = {
ensurePGStatStatement: co.wrap(ensurePGStatStatement),
ensureNonStarterPlan: co.wrap(ensureNonStarterPlan),
ensureEssentialTierPlan: co.wrap(ensureEssentialTierPlan),
newTotalExecTimeField: co.wrap(newTotalExecTimeField)
}

0 comments on commit bffa1d6

Please sign in to comment.