heroku 10.7.1-alpha.1 → 10.8.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/pg/upgrade/cancel.d.ts +13 -0
- package/lib/commands/pg/upgrade/cancel.js +53 -0
- package/lib/commands/pg/upgrade/dryrun.d.ts +14 -0
- package/lib/commands/pg/upgrade/dryrun.js +54 -0
- package/lib/commands/pg/upgrade/index.js +76 -0
- package/lib/commands/pg/upgrade/prepare.d.ts +14 -0
- package/lib/commands/pg/upgrade/prepare.js +54 -0
- package/lib/commands/pg/upgrade/run.d.ts +16 -0
- package/lib/commands/pg/upgrade/run.js +98 -0
- package/lib/commands/pg/upgrade/wait.d.ts +16 -0
- package/lib/commands/pg/upgrade/wait.js +103 -0
- package/lib/lib/pg/types.d.ts +15 -0
- package/lib/lib/pg/util.d.ts +1 -0
- package/lib/lib/pg/util.js +5 -1
- package/oclif.manifest.json +337 -60
- package/package.json +3 -3
- package/lib/commands/pg/upgrade.js +0 -59
- /package/lib/commands/pg/{upgrade.d.ts → upgrade/index.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
export default class Upgrade extends Command {
|
|
3
|
+
static topic: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
static args: {
|
|
10
|
+
database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
7
|
+
const fetcher_1 = require("../../../lib/pg/fetcher");
|
|
8
|
+
const host_1 = require("../../../lib/pg/host");
|
|
9
|
+
const util_1 = require("../../../lib/pg/util");
|
|
10
|
+
const confirmCommand_1 = require("../../../lib/confirmCommand");
|
|
11
|
+
const nls_1 = require("../../../nls");
|
|
12
|
+
class Upgrade extends command_1.Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags, args } = await this.parse(Upgrade);
|
|
15
|
+
const { app, confirm } = flags;
|
|
16
|
+
const { database } = args;
|
|
17
|
+
const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
|
|
18
|
+
if ((0, util_1.legacyEssentialPlan)(db))
|
|
19
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
|
|
20
|
+
if ((0, util_1.essentialNumPlan)(db))
|
|
21
|
+
core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:cancel')} on Essential-tier databases. You can only use this command on Standard-tier and higher leader databases.`);
|
|
22
|
+
const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
|
|
23
|
+
if (replica.following)
|
|
24
|
+
core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:cancel')} on follower databases. You can only use this command on Standard-tier and higher leader databases.`);
|
|
25
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
26
|
+
Destructive action
|
|
27
|
+
You're canceling the scheduled version upgrade for ${color_1.default.addon(db.name)}.
|
|
28
|
+
|
|
29
|
+
You can't undo this action.
|
|
30
|
+
`));
|
|
31
|
+
try {
|
|
32
|
+
core_1.ux.action.start(`Cancelling upgrade on ${color_1.default.addon(db.name)}`);
|
|
33
|
+
const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/cancel`, { hostname: (0, host_1.default)(), body: {} });
|
|
34
|
+
core_1.ux.action.stop('done\n' + (0, util_1.formatResponseWithCommands)(response.body.message));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const response = error;
|
|
38
|
+
core_1.ux.error((0, util_1.formatResponseWithCommands)(response.body.message) + `\n\nError ID: ${response.body.id}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = Upgrade;
|
|
43
|
+
Upgrade.topic = 'pg';
|
|
44
|
+
Upgrade.description = (0, tsheredoc_1.default)(`
|
|
45
|
+
cancels a scheduled upgrade. You can't cancel a version upgrade that's in progress.
|
|
46
|
+
`);
|
|
47
|
+
Upgrade.flags = {
|
|
48
|
+
confirm: command_1.flags.string({ char: 'c' }),
|
|
49
|
+
app: command_1.flags.app({ required: true }),
|
|
50
|
+
};
|
|
51
|
+
Upgrade.args = {
|
|
52
|
+
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
|
|
53
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
export default class Upgrade extends Command {
|
|
3
|
+
static topic: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
7
|
+
const fetcher_1 = require("../../../lib/pg/fetcher");
|
|
8
|
+
const host_1 = require("../../../lib/pg/host");
|
|
9
|
+
const util_1 = require("../../../lib/pg/util");
|
|
10
|
+
const confirmCommand_1 = require("../../../lib/confirmCommand");
|
|
11
|
+
const nls_1 = require("../../../nls");
|
|
12
|
+
class Upgrade extends command_1.Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags, args } = await this.parse(Upgrade);
|
|
15
|
+
const { app, version, confirm } = flags;
|
|
16
|
+
const { database } = args;
|
|
17
|
+
const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
|
|
18
|
+
if ((0, util_1.legacyEssentialPlan)(db))
|
|
19
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
|
|
20
|
+
if ((0, util_1.essentialNumPlan)(db))
|
|
21
|
+
core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:dryrun')} on Essential-tier databases. You can only use this command on Standard-tier and higher leader databases.`);
|
|
22
|
+
const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
|
|
23
|
+
const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
|
|
24
|
+
if (replica.following)
|
|
25
|
+
core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:dryrun')} on follower databases. You can only use this command on Standard-tier and higher leader databases.`);
|
|
26
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
27
|
+
Destructive action
|
|
28
|
+
This command starts a test upgrade for ${color_1.default.addon(db.name)} to ${versionPhrase}.
|
|
29
|
+
`));
|
|
30
|
+
try {
|
|
31
|
+
const data = { version };
|
|
32
|
+
core_1.ux.action.start(`Starting a test upgrade on ${color_1.default.addon(db.name)}`);
|
|
33
|
+
const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/dry_run`, { hostname: (0, host_1.default)(), body: data });
|
|
34
|
+
core_1.ux.action.stop('done\n' + (0, util_1.formatResponseWithCommands)(response.body.message));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const response = error;
|
|
38
|
+
core_1.ux.error((0, util_1.formatResponseWithCommands)(response.body.message) + `\n\nError ID: ${response.body.id}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = Upgrade;
|
|
43
|
+
Upgrade.topic = 'pg';
|
|
44
|
+
Upgrade.description = (0, tsheredoc_1.default)(`
|
|
45
|
+
simulates a Postgres version upgrade on a Standard-tier and higher leader database by creating and upgrading a follower database. Heroku sends the results of the test upgrade via email.
|
|
46
|
+
`);
|
|
47
|
+
Upgrade.flags = {
|
|
48
|
+
confirm: command_1.flags.string({ char: 'c' }),
|
|
49
|
+
version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
|
|
50
|
+
app: command_1.flags.app({ required: true }),
|
|
51
|
+
};
|
|
52
|
+
Upgrade.args = {
|
|
53
|
+
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
|
|
54
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
7
|
+
const fetcher_1 = require("../../../lib/pg/fetcher");
|
|
8
|
+
const host_1 = require("../../../lib/pg/host");
|
|
9
|
+
const util_1 = require("../../../lib/pg/util");
|
|
10
|
+
const confirmCommand_1 = require("../../../lib/confirmCommand");
|
|
11
|
+
const nls_1 = require("../../../nls");
|
|
12
|
+
class Upgrade extends command_1.Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags, args } = await this.parse(Upgrade);
|
|
15
|
+
const { app, version, confirm } = flags;
|
|
16
|
+
const { database } = args;
|
|
17
|
+
const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
|
|
18
|
+
if ((0, util_1.legacyEssentialPlan)(db))
|
|
19
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade')} on Essential-tier databases and follower databases on Standard-tier and higher plans.`);
|
|
20
|
+
const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
|
|
21
|
+
const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
|
|
22
|
+
if (replica.following) {
|
|
23
|
+
const { body: configVars } = await this.heroku.get(`/apps/${app}/config-vars`);
|
|
24
|
+
const origin = (0, util_1.databaseNameFromUrl)(replica.following, configVars);
|
|
25
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
26
|
+
We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.
|
|
27
|
+
|
|
28
|
+
Destructive action
|
|
29
|
+
You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}. The database will stop following ${origin} and become writable.
|
|
30
|
+
|
|
31
|
+
You can't undo this action.
|
|
32
|
+
`));
|
|
33
|
+
}
|
|
34
|
+
else if ((0, util_1.essentialNumPlan)(db)) {
|
|
35
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
36
|
+
We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.
|
|
37
|
+
|
|
38
|
+
Destructive action
|
|
39
|
+
You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}.
|
|
40
|
+
|
|
41
|
+
You can't undo this action.
|
|
42
|
+
`));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
core_1.ux.warn((0, tsheredoc_1.default)(`
|
|
46
|
+
We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.`));
|
|
47
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade')} on Essential-tier databases and follower databases on Standard-tier and higher plans.`);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const data = { version };
|
|
51
|
+
core_1.ux.action.start(`Starting upgrade on ${color_1.default.addon(db.name)}`);
|
|
52
|
+
const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade`, { hostname: (0, host_1.default)(), body: data });
|
|
53
|
+
core_1.ux.action.stop((0, tsheredoc_1.default)(`done\n${(0, util_1.formatResponseWithCommands)(response.body.message)}`));
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const response = error;
|
|
57
|
+
core_1.ux.error((0, tsheredoc_1.default)(`${(0, util_1.formatResponseWithCommands)(response.body.message)}\n\nError ID: ${response.body.id}`));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.default = Upgrade;
|
|
62
|
+
Upgrade.topic = 'pg';
|
|
63
|
+
Upgrade.description = (0, tsheredoc_1.default)(`
|
|
64
|
+
We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.
|
|
65
|
+
|
|
66
|
+
For an Essential-tier plan, this command upgrades the database's Postgres version. For a Standard-tier and higher plan, this command unfollows the leader database before upgrading the Postgres version.
|
|
67
|
+
`);
|
|
68
|
+
Upgrade.flags = {
|
|
69
|
+
confirm: command_1.flags.string({ char: 'c' }),
|
|
70
|
+
version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
|
|
71
|
+
app: command_1.flags.app({ required: true }),
|
|
72
|
+
remote: command_1.flags.remote(),
|
|
73
|
+
};
|
|
74
|
+
Upgrade.args = {
|
|
75
|
+
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
|
|
76
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
export default class Upgrade extends Command {
|
|
3
|
+
static topic: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
7
|
+
const fetcher_1 = require("../../../lib/pg/fetcher");
|
|
8
|
+
const host_1 = require("../../../lib/pg/host");
|
|
9
|
+
const util_1 = require("../../../lib/pg/util");
|
|
10
|
+
const confirmCommand_1 = require("../../../lib/confirmCommand");
|
|
11
|
+
const nls_1 = require("../../../nls");
|
|
12
|
+
class Upgrade extends command_1.Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags, args } = await this.parse(Upgrade);
|
|
15
|
+
const { app, version, confirm } = flags;
|
|
16
|
+
const { database } = args;
|
|
17
|
+
const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
|
|
18
|
+
if ((0, util_1.legacyEssentialPlan)(db))
|
|
19
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
|
|
20
|
+
if ((0, util_1.essentialNumPlan)(db))
|
|
21
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade:prepare')} on Standard-tier and higher leader databases. For Essential-tier databases, use ${color_1.default.cmd('heroku pg:upgrade:run')} instead.`);
|
|
22
|
+
const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
|
|
23
|
+
const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
|
|
24
|
+
if (replica.following)
|
|
25
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade:prepare')} on Standard-tier and higher leader databases. For follower databases, use ${color_1.default.cmd('heroku pg:upgrade:run')} instead.`);
|
|
26
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
27
|
+
Destructive action
|
|
28
|
+
This command prepares the upgrade for ${color_1.default.addon(db.name)} to ${versionPhrase} and schedules to upgrade it during the next available maintenance window.
|
|
29
|
+
`));
|
|
30
|
+
try {
|
|
31
|
+
const data = { version };
|
|
32
|
+
core_1.ux.action.start(`Preparing upgrade on ${color_1.default.addon(db.name)}`);
|
|
33
|
+
const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/prepare`, { hostname: (0, host_1.default)(), body: data });
|
|
34
|
+
core_1.ux.action.stop((0, tsheredoc_1.default)(`done\n${(0, util_1.formatResponseWithCommands)(response.body.message)}`));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const response = error;
|
|
38
|
+
core_1.ux.error((0, tsheredoc_1.default)(`${(0, util_1.formatResponseWithCommands)(response.body.message)}\n\nError ID: ${response.body.id}`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = Upgrade;
|
|
43
|
+
Upgrade.topic = 'pg';
|
|
44
|
+
Upgrade.description = (0, tsheredoc_1.default)(`
|
|
45
|
+
prepares the upgrade for Standard-tier and higher leader databases and schedules it for the next available maintenance window. To start a version upgrade on Essential-tier and follower databases, use ${color_1.default.cmd('heroku pg:upgrade:run')} instead.
|
|
46
|
+
`);
|
|
47
|
+
Upgrade.flags = {
|
|
48
|
+
confirm: command_1.flags.string({ char: 'c' }),
|
|
49
|
+
version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
|
|
50
|
+
app: command_1.flags.app({ required: true }),
|
|
51
|
+
};
|
|
52
|
+
Upgrade.args = {
|
|
53
|
+
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
|
|
54
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
export default class Upgrade extends Command {
|
|
3
|
+
static topic: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
7
|
+
const fetcher_1 = require("../../../lib/pg/fetcher");
|
|
8
|
+
const host_1 = require("../../../lib/pg/host");
|
|
9
|
+
const util_1 = require("../../../lib/pg/util");
|
|
10
|
+
const confirmCommand_1 = require("../../../lib/confirmCommand");
|
|
11
|
+
const nls_1 = require("../../../nls");
|
|
12
|
+
class Upgrade extends command_1.Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags, args } = await this.parse(Upgrade);
|
|
15
|
+
const { app, version, confirm } = flags;
|
|
16
|
+
const { database } = args;
|
|
17
|
+
const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
|
|
18
|
+
if ((0, util_1.legacyEssentialPlan)(db))
|
|
19
|
+
core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
|
|
20
|
+
const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
|
|
21
|
+
const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
|
|
22
|
+
if ((0, util_1.essentialNumPlan)(db)) {
|
|
23
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
24
|
+
Destructive action
|
|
25
|
+
You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}.
|
|
26
|
+
|
|
27
|
+
You can't undo this action.
|
|
28
|
+
`));
|
|
29
|
+
}
|
|
30
|
+
else if (replica.following) {
|
|
31
|
+
const { body: configVars } = await this.heroku.get(`/apps/${app}/config-vars`);
|
|
32
|
+
const origin = (0, util_1.databaseNameFromUrl)(replica.following, configVars);
|
|
33
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
34
|
+
Destructive action
|
|
35
|
+
You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}. The database will stop following ${origin} and become writable.
|
|
36
|
+
|
|
37
|
+
You can't undo this action.
|
|
38
|
+
`));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
42
|
+
Destructive action
|
|
43
|
+
You're upgrading the Postgres version on ${color_1.default.addon(db.name)}. This action also upgrades any followers on the database.
|
|
44
|
+
|
|
45
|
+
You can't undo this action.
|
|
46
|
+
`));
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const data = { version };
|
|
50
|
+
core_1.ux.action.start(`Starting upgrade on ${color_1.default.addon(db.name)}`);
|
|
51
|
+
const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/run`, { hostname: (0, host_1.default)(), body: data });
|
|
52
|
+
core_1.ux.action.stop((0, tsheredoc_1.default)(`done\n${(0, util_1.formatResponseWithCommands)(response.body.message)}`));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (error instanceof Error && 'body' in error) {
|
|
56
|
+
const response = error;
|
|
57
|
+
core_1.ux.error((0, tsheredoc_1.default)(`${(0, util_1.formatResponseWithCommands)(response.body.message)}\n\nError ID: ${response.body.id}`));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.default = Upgrade;
|
|
66
|
+
Upgrade.topic = 'pg';
|
|
67
|
+
Upgrade.description = (0, tsheredoc_1.default)(`
|
|
68
|
+
starts a Postgres version upgrade
|
|
69
|
+
|
|
70
|
+
On Essential-tier databases, this command upgrades the database's Postgres version.
|
|
71
|
+
|
|
72
|
+
On Standard-tier and higher leader databases, this command runs a previously scheduled Postgres version upgrade. You must run ${color_1.default.cmd('pg:upgrade:prepare')} before this command to schedule a version upgrade.
|
|
73
|
+
|
|
74
|
+
On follower databases, this command unfollows the leader database before upgrading the follower's Postgres version.
|
|
75
|
+
`);
|
|
76
|
+
Upgrade.examples = [
|
|
77
|
+
(0, tsheredoc_1.default) `
|
|
78
|
+
# Upgrade an Essential-tier database to a specific version
|
|
79
|
+
$ heroku pg:upgrade:run postgresql-curved-12345 --version 14 --app myapp
|
|
80
|
+
`,
|
|
81
|
+
(0, tsheredoc_1.default) `
|
|
82
|
+
# Upgrade a Standard-tier follower database to the latest supported version
|
|
83
|
+
$ heroku pg:upgrade:run HEROKU_POSTGRESQL_BLUE_URL --app myapp
|
|
84
|
+
`,
|
|
85
|
+
(0, tsheredoc_1.default) `
|
|
86
|
+
# Run a previously scheduled upgrade on a Standard-tier leader database
|
|
87
|
+
$ heroku pg:upgrade:run DATABASE_URL --app myapp
|
|
88
|
+
`,
|
|
89
|
+
];
|
|
90
|
+
Upgrade.flags = {
|
|
91
|
+
confirm: command_1.flags.string({ char: 'c' }),
|
|
92
|
+
version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
|
|
93
|
+
app: command_1.flags.app({ required: true }),
|
|
94
|
+
remote: command_1.flags.remote({ char: 'r' }),
|
|
95
|
+
};
|
|
96
|
+
Upgrade.args = {
|
|
97
|
+
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
|
|
98
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
export default class Wait extends Command {
|
|
3
|
+
static topic: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
'wait-interval': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
'no-notify': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static args: {
|
|
13
|
+
database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const debug_1 = require("debug");
|
|
7
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
8
|
+
const fetcher_1 = require("../../../lib/pg/fetcher");
|
|
9
|
+
const host_1 = require("../../../lib/pg/host");
|
|
10
|
+
const notify_1 = require("../../../lib/notify");
|
|
11
|
+
const http_call_1 = require("@heroku/http-call");
|
|
12
|
+
const nls_1 = require("../../../nls");
|
|
13
|
+
const util_1 = require("../../../lib/pg/util");
|
|
14
|
+
const wait = (ms) => new Promise(resolve => {
|
|
15
|
+
setTimeout(resolve, ms);
|
|
16
|
+
});
|
|
17
|
+
class Wait extends command_1.Command {
|
|
18
|
+
async run() {
|
|
19
|
+
const { flags, args } = await this.parse(Wait);
|
|
20
|
+
const { app, 'wait-interval': waitInterval } = flags;
|
|
21
|
+
const dbName = args.database;
|
|
22
|
+
const pgDebug = (0, debug_1.default)('pg');
|
|
23
|
+
const waitFor = async (db) => {
|
|
24
|
+
const interval = (!waitInterval || waitInterval < 0) ? 5 : waitInterval;
|
|
25
|
+
let status;
|
|
26
|
+
let waiting = false;
|
|
27
|
+
let retries = 20;
|
|
28
|
+
const notFoundMessage = 'Waiting to provision...';
|
|
29
|
+
while (true) {
|
|
30
|
+
try {
|
|
31
|
+
({ body: status } = await this.heroku.get(`/client/v11/databases/${db.id}/upgrade/wait_status`, { hostname: (0, host_1.default)() }));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error instanceof http_call_1.HTTPError && (!retries || error.statusCode !== 404)) {
|
|
35
|
+
const httpError = error;
|
|
36
|
+
pgDebug(httpError);
|
|
37
|
+
throw httpError;
|
|
38
|
+
}
|
|
39
|
+
retries--;
|
|
40
|
+
status = { 'waiting?': true, message: notFoundMessage };
|
|
41
|
+
}
|
|
42
|
+
let message = (0, util_1.formatResponseWithCommands)(status.message);
|
|
43
|
+
if (status.step)
|
|
44
|
+
message = (0, tsheredoc_1.default)(`(${status.step}) ${message}`);
|
|
45
|
+
if (status['error?']) {
|
|
46
|
+
(0, notify_1.default)('error', `${db.name} ${message}`, false);
|
|
47
|
+
core_1.ux.error(message || '', { exit: 1 });
|
|
48
|
+
}
|
|
49
|
+
if (!status['waiting?']) {
|
|
50
|
+
if (waiting) {
|
|
51
|
+
core_1.ux.action.stop(message);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
core_1.ux.log((0, tsheredoc_1.default)(`Waiting for database ${color_1.default.yellow(db.name)}... ${message}`));
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!waiting) {
|
|
59
|
+
waiting = true;
|
|
60
|
+
core_1.ux.action.start(`Waiting for database ${color_1.default.yellow(db.name)}`, message);
|
|
61
|
+
}
|
|
62
|
+
core_1.ux.action.status = message;
|
|
63
|
+
await wait(interval * 1000);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
let dbs = [];
|
|
67
|
+
if (dbName) {
|
|
68
|
+
dbs = [await (0, fetcher_1.getAddon)(this.heroku, app, dbName)];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
core_1.ux.error((0, tsheredoc_1.default)('You must provide a database. Run `--help` for more information on the command.'));
|
|
72
|
+
}
|
|
73
|
+
for (const db of dbs) {
|
|
74
|
+
await waitFor(db);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = Wait;
|
|
79
|
+
Wait.topic = 'pg';
|
|
80
|
+
Wait.description = 'provides the status of an upgrade and blocks it until the operation is complete';
|
|
81
|
+
Wait.flags = {
|
|
82
|
+
'wait-interval': command_1.flags.integer({ description: 'how frequently to poll in seconds (to avoid rate limiting)' }),
|
|
83
|
+
'no-notify': command_1.flags.boolean({ description: 'do not show OS notification' }),
|
|
84
|
+
app: command_1.flags.app({ required: true }),
|
|
85
|
+
remote: command_1.flags.remote(),
|
|
86
|
+
};
|
|
87
|
+
Wait.examples = [
|
|
88
|
+
(0, tsheredoc_1.default)(`
|
|
89
|
+
# Wait for upgrade to complete with default settings
|
|
90
|
+
$ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp
|
|
91
|
+
`),
|
|
92
|
+
(0, tsheredoc_1.default)(`
|
|
93
|
+
# Wait with custom polling interval
|
|
94
|
+
$ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --wait-interval 10
|
|
95
|
+
`),
|
|
96
|
+
(0, tsheredoc_1.default)(`
|
|
97
|
+
# Wait without showing OS notifications
|
|
98
|
+
$ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --no-notify
|
|
99
|
+
`),
|
|
100
|
+
];
|
|
101
|
+
Wait.args = {
|
|
102
|
+
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')}` }),
|
|
103
|
+
};
|
package/lib/lib/pg/types.d.ts
CHANGED
|
@@ -94,6 +94,12 @@ export declare type PgStatus = {
|
|
|
94
94
|
'error?': boolean;
|
|
95
95
|
message: string;
|
|
96
96
|
};
|
|
97
|
+
export declare type PgUpgradeStatus = {
|
|
98
|
+
'waiting?': boolean;
|
|
99
|
+
'error?': boolean;
|
|
100
|
+
message: string;
|
|
101
|
+
step: string;
|
|
102
|
+
};
|
|
97
103
|
declare type TenantInfoNames = 'Plan' | 'Status' | 'Connections' | 'PG Version' | 'Created' | 'Data Size' | 'Tables' | 'Fork/Follow' | 'Rollback' | 'Continuous Protection' | 'Billing App' | 'Add-on';
|
|
98
104
|
export declare type TenantInfo = {
|
|
99
105
|
name: TenantInfoNames;
|
|
@@ -114,6 +120,15 @@ export declare type PgDatabaseTenant = {
|
|
|
114
120
|
info: Array<TenantInfo>;
|
|
115
121
|
};
|
|
116
122
|
export declare type PgDatabase = PgDatabaseService & PgDatabaseTenant;
|
|
123
|
+
export declare type PgUpgradeResponse = {
|
|
124
|
+
message: string;
|
|
125
|
+
};
|
|
126
|
+
export declare type PgUpgradeError = {
|
|
127
|
+
body: {
|
|
128
|
+
id: string;
|
|
129
|
+
message: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
117
132
|
export declare type AddOnWithPlan = Required<Heroku.AddOnAttachment['addon']> & {
|
|
118
133
|
plan: Required<Heroku.AddOn['plan']>;
|
|
119
134
|
};
|
package/lib/lib/pg/util.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function essentialPlan(addon: AddOnAttachmentWithConfigVarsAndPla
|
|
|
9
9
|
export declare function getConfigVarNameFromAttachment(attachment: Required<AddOnAttachment & {
|
|
10
10
|
addon: AddOnAttachmentWithConfigVarsAndPlan;
|
|
11
11
|
}>, config?: Record<string, string>): string;
|
|
12
|
+
export declare function formatResponseWithCommands(response: string): string;
|
|
12
13
|
export declare function presentCredentialAttachments(app: string, credAttachments: Required<AddOnAttachment>[], credentials: CredentialsInfo, cred: string): string;
|
|
13
14
|
export declare type ConnectionDetails = {
|
|
14
15
|
user: string;
|
package/lib/lib/pg/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parsePostgresConnectionString = exports.databaseNameFromUrl = exports.configVarNamesFromValue = exports.bastionKeyPlan = exports.getConnectionDetails = exports.presentCredentialAttachments = exports.getConfigVarNameFromAttachment = exports.essentialPlan = exports.legacyEssentialPlan = exports.essentialNumPlan = exports.getConfigVarName = void 0;
|
|
3
|
+
exports.parsePostgresConnectionString = exports.databaseNameFromUrl = exports.configVarNamesFromValue = exports.bastionKeyPlan = exports.getConnectionDetails = exports.presentCredentialAttachments = exports.formatResponseWithCommands = exports.getConfigVarNameFromAttachment = exports.essentialPlan = exports.legacyEssentialPlan = exports.essentialNumPlan = exports.getConfigVarName = void 0;
|
|
4
4
|
const color_1 = require("@heroku-cli/color");
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const debug_1 = require("debug");
|
|
@@ -39,6 +39,10 @@ function getConfigVarNameFromAttachment(attachment, config = {}) {
|
|
|
39
39
|
return getConfigVarName(configVars);
|
|
40
40
|
}
|
|
41
41
|
exports.getConfigVarNameFromAttachment = getConfigVarNameFromAttachment;
|
|
42
|
+
function formatResponseWithCommands(response) {
|
|
43
|
+
return response.replace(/`(.*?)`/g, (_, word) => color_1.default.cmd(word));
|
|
44
|
+
}
|
|
45
|
+
exports.formatResponseWithCommands = formatResponseWithCommands;
|
|
42
46
|
function presentCredentialAttachments(app, credAttachments, credentials, cred) {
|
|
43
47
|
const isForeignApp = (attOrAddon) => attOrAddon.app.name === app ? 0 : 1;
|
|
44
48
|
const comparators = [
|
package/oclif.manifest.json
CHANGED
|
@@ -7211,65 +7211,6 @@
|
|
|
7211
7211
|
"unfollow.js"
|
|
7212
7212
|
]
|
|
7213
7213
|
},
|
|
7214
|
-
"pg:upgrade": {
|
|
7215
|
-
"aliases": [],
|
|
7216
|
-
"args": {
|
|
7217
|
-
"database": {
|
|
7218
|
-
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL.",
|
|
7219
|
-
"name": "database"
|
|
7220
|
-
}
|
|
7221
|
-
},
|
|
7222
|
-
"description": "For an Essential-* plan, this command upgrades the database's PostgreSQL version. For a Standard-tier and higher plan, this command unfollows the leader database before upgrading the PostgreSQL version.\nTo upgrade to another PostgreSQL version, use pg:copy instead\n",
|
|
7223
|
-
"flags": {
|
|
7224
|
-
"confirm": {
|
|
7225
|
-
"char": "c",
|
|
7226
|
-
"name": "confirm",
|
|
7227
|
-
"hasDynamicHelp": false,
|
|
7228
|
-
"multiple": false,
|
|
7229
|
-
"type": "option"
|
|
7230
|
-
},
|
|
7231
|
-
"version": {
|
|
7232
|
-
"char": "v",
|
|
7233
|
-
"description": "PostgreSQL version to upgrade to",
|
|
7234
|
-
"name": "version",
|
|
7235
|
-
"hasDynamicHelp": false,
|
|
7236
|
-
"multiple": false,
|
|
7237
|
-
"type": "option"
|
|
7238
|
-
},
|
|
7239
|
-
"app": {
|
|
7240
|
-
"char": "a",
|
|
7241
|
-
"description": "app to run command against",
|
|
7242
|
-
"name": "app",
|
|
7243
|
-
"required": true,
|
|
7244
|
-
"hasDynamicHelp": false,
|
|
7245
|
-
"multiple": false,
|
|
7246
|
-
"type": "option"
|
|
7247
|
-
},
|
|
7248
|
-
"remote": {
|
|
7249
|
-
"char": "r",
|
|
7250
|
-
"description": "git remote of app to use",
|
|
7251
|
-
"name": "remote",
|
|
7252
|
-
"hasDynamicHelp": false,
|
|
7253
|
-
"multiple": false,
|
|
7254
|
-
"type": "option"
|
|
7255
|
-
}
|
|
7256
|
-
},
|
|
7257
|
-
"hasDynamicHelp": false,
|
|
7258
|
-
"hiddenAliases": [],
|
|
7259
|
-
"id": "pg:upgrade",
|
|
7260
|
-
"pluginAlias": "heroku",
|
|
7261
|
-
"pluginName": "heroku",
|
|
7262
|
-
"pluginType": "core",
|
|
7263
|
-
"strict": true,
|
|
7264
|
-
"topic": "pg",
|
|
7265
|
-
"isESM": false,
|
|
7266
|
-
"relativePath": [
|
|
7267
|
-
"lib",
|
|
7268
|
-
"commands",
|
|
7269
|
-
"pg",
|
|
7270
|
-
"upgrade.js"
|
|
7271
|
-
]
|
|
7272
|
-
},
|
|
7273
7214
|
"pg:vacuum-stats": {
|
|
7274
7215
|
"aliases": [],
|
|
7275
7216
|
"args": {
|
|
@@ -13203,6 +13144,342 @@
|
|
|
13203
13144
|
"track-functions.js"
|
|
13204
13145
|
]
|
|
13205
13146
|
},
|
|
13147
|
+
"pg:upgrade:cancel": {
|
|
13148
|
+
"aliases": [],
|
|
13149
|
+
"args": {
|
|
13150
|
+
"database": {
|
|
13151
|
+
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL.",
|
|
13152
|
+
"name": "database"
|
|
13153
|
+
}
|
|
13154
|
+
},
|
|
13155
|
+
"description": "cancels a scheduled upgrade. You can't cancel a version upgrade that's in progress.\n",
|
|
13156
|
+
"flags": {
|
|
13157
|
+
"confirm": {
|
|
13158
|
+
"char": "c",
|
|
13159
|
+
"name": "confirm",
|
|
13160
|
+
"hasDynamicHelp": false,
|
|
13161
|
+
"multiple": false,
|
|
13162
|
+
"type": "option"
|
|
13163
|
+
},
|
|
13164
|
+
"app": {
|
|
13165
|
+
"char": "a",
|
|
13166
|
+
"description": "app to run command against",
|
|
13167
|
+
"name": "app",
|
|
13168
|
+
"required": true,
|
|
13169
|
+
"hasDynamicHelp": false,
|
|
13170
|
+
"multiple": false,
|
|
13171
|
+
"type": "option"
|
|
13172
|
+
}
|
|
13173
|
+
},
|
|
13174
|
+
"hasDynamicHelp": false,
|
|
13175
|
+
"hiddenAliases": [],
|
|
13176
|
+
"id": "pg:upgrade:cancel",
|
|
13177
|
+
"pluginAlias": "heroku",
|
|
13178
|
+
"pluginName": "heroku",
|
|
13179
|
+
"pluginType": "core",
|
|
13180
|
+
"strict": true,
|
|
13181
|
+
"topic": "pg",
|
|
13182
|
+
"isESM": false,
|
|
13183
|
+
"relativePath": [
|
|
13184
|
+
"lib",
|
|
13185
|
+
"commands",
|
|
13186
|
+
"pg",
|
|
13187
|
+
"upgrade",
|
|
13188
|
+
"cancel.js"
|
|
13189
|
+
]
|
|
13190
|
+
},
|
|
13191
|
+
"pg:upgrade:dryrun": {
|
|
13192
|
+
"aliases": [],
|
|
13193
|
+
"args": {
|
|
13194
|
+
"database": {
|
|
13195
|
+
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL.",
|
|
13196
|
+
"name": "database"
|
|
13197
|
+
}
|
|
13198
|
+
},
|
|
13199
|
+
"description": "simulates a Postgres version upgrade on a Standard-tier and higher leader database by creating and upgrading a follower database. Heroku sends the results of the test upgrade via email.\n",
|
|
13200
|
+
"flags": {
|
|
13201
|
+
"confirm": {
|
|
13202
|
+
"char": "c",
|
|
13203
|
+
"name": "confirm",
|
|
13204
|
+
"hasDynamicHelp": false,
|
|
13205
|
+
"multiple": false,
|
|
13206
|
+
"type": "option"
|
|
13207
|
+
},
|
|
13208
|
+
"version": {
|
|
13209
|
+
"char": "v",
|
|
13210
|
+
"description": "Postgres version to upgrade to",
|
|
13211
|
+
"name": "version",
|
|
13212
|
+
"hasDynamicHelp": false,
|
|
13213
|
+
"multiple": false,
|
|
13214
|
+
"type": "option"
|
|
13215
|
+
},
|
|
13216
|
+
"app": {
|
|
13217
|
+
"char": "a",
|
|
13218
|
+
"description": "app to run command against",
|
|
13219
|
+
"name": "app",
|
|
13220
|
+
"required": true,
|
|
13221
|
+
"hasDynamicHelp": false,
|
|
13222
|
+
"multiple": false,
|
|
13223
|
+
"type": "option"
|
|
13224
|
+
}
|
|
13225
|
+
},
|
|
13226
|
+
"hasDynamicHelp": false,
|
|
13227
|
+
"hiddenAliases": [],
|
|
13228
|
+
"id": "pg:upgrade:dryrun",
|
|
13229
|
+
"pluginAlias": "heroku",
|
|
13230
|
+
"pluginName": "heroku",
|
|
13231
|
+
"pluginType": "core",
|
|
13232
|
+
"strict": true,
|
|
13233
|
+
"topic": "pg",
|
|
13234
|
+
"isESM": false,
|
|
13235
|
+
"relativePath": [
|
|
13236
|
+
"lib",
|
|
13237
|
+
"commands",
|
|
13238
|
+
"pg",
|
|
13239
|
+
"upgrade",
|
|
13240
|
+
"dryrun.js"
|
|
13241
|
+
]
|
|
13242
|
+
},
|
|
13243
|
+
"pg:upgrade": {
|
|
13244
|
+
"aliases": [],
|
|
13245
|
+
"args": {
|
|
13246
|
+
"database": {
|
|
13247
|
+
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL.",
|
|
13248
|
+
"name": "database"
|
|
13249
|
+
}
|
|
13250
|
+
},
|
|
13251
|
+
"description": "We're deprecating this command. To upgrade your database's Postgres version, use the new pg:upgrade:* subcommands. See https://devcenter.heroku.com/changelog-items/3179.\n\nFor an Essential-tier plan, this command upgrades the database's Postgres version. For a Standard-tier and higher plan, this command unfollows the leader database before upgrading the Postgres version.\n",
|
|
13252
|
+
"flags": {
|
|
13253
|
+
"confirm": {
|
|
13254
|
+
"char": "c",
|
|
13255
|
+
"name": "confirm",
|
|
13256
|
+
"hasDynamicHelp": false,
|
|
13257
|
+
"multiple": false,
|
|
13258
|
+
"type": "option"
|
|
13259
|
+
},
|
|
13260
|
+
"version": {
|
|
13261
|
+
"char": "v",
|
|
13262
|
+
"description": "Postgres version to upgrade to",
|
|
13263
|
+
"name": "version",
|
|
13264
|
+
"hasDynamicHelp": false,
|
|
13265
|
+
"multiple": false,
|
|
13266
|
+
"type": "option"
|
|
13267
|
+
},
|
|
13268
|
+
"app": {
|
|
13269
|
+
"char": "a",
|
|
13270
|
+
"description": "app to run command against",
|
|
13271
|
+
"name": "app",
|
|
13272
|
+
"required": true,
|
|
13273
|
+
"hasDynamicHelp": false,
|
|
13274
|
+
"multiple": false,
|
|
13275
|
+
"type": "option"
|
|
13276
|
+
},
|
|
13277
|
+
"remote": {
|
|
13278
|
+
"char": "r",
|
|
13279
|
+
"description": "git remote of app to use",
|
|
13280
|
+
"name": "remote",
|
|
13281
|
+
"hasDynamicHelp": false,
|
|
13282
|
+
"multiple": false,
|
|
13283
|
+
"type": "option"
|
|
13284
|
+
}
|
|
13285
|
+
},
|
|
13286
|
+
"hasDynamicHelp": false,
|
|
13287
|
+
"hiddenAliases": [],
|
|
13288
|
+
"id": "pg:upgrade",
|
|
13289
|
+
"pluginAlias": "heroku",
|
|
13290
|
+
"pluginName": "heroku",
|
|
13291
|
+
"pluginType": "core",
|
|
13292
|
+
"strict": true,
|
|
13293
|
+
"topic": "pg",
|
|
13294
|
+
"isESM": false,
|
|
13295
|
+
"relativePath": [
|
|
13296
|
+
"lib",
|
|
13297
|
+
"commands",
|
|
13298
|
+
"pg",
|
|
13299
|
+
"upgrade",
|
|
13300
|
+
"index.js"
|
|
13301
|
+
]
|
|
13302
|
+
},
|
|
13303
|
+
"pg:upgrade:prepare": {
|
|
13304
|
+
"aliases": [],
|
|
13305
|
+
"args": {
|
|
13306
|
+
"database": {
|
|
13307
|
+
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL.",
|
|
13308
|
+
"name": "database"
|
|
13309
|
+
}
|
|
13310
|
+
},
|
|
13311
|
+
"description": "prepares the upgrade for Standard-tier and higher leader databases and schedules it for the next available maintenance window. To start a version upgrade on Essential-tier and follower databases, use heroku pg:upgrade:run instead.\n",
|
|
13312
|
+
"flags": {
|
|
13313
|
+
"confirm": {
|
|
13314
|
+
"char": "c",
|
|
13315
|
+
"name": "confirm",
|
|
13316
|
+
"hasDynamicHelp": false,
|
|
13317
|
+
"multiple": false,
|
|
13318
|
+
"type": "option"
|
|
13319
|
+
},
|
|
13320
|
+
"version": {
|
|
13321
|
+
"char": "v",
|
|
13322
|
+
"description": "Postgres version to upgrade to",
|
|
13323
|
+
"name": "version",
|
|
13324
|
+
"hasDynamicHelp": false,
|
|
13325
|
+
"multiple": false,
|
|
13326
|
+
"type": "option"
|
|
13327
|
+
},
|
|
13328
|
+
"app": {
|
|
13329
|
+
"char": "a",
|
|
13330
|
+
"description": "app to run command against",
|
|
13331
|
+
"name": "app",
|
|
13332
|
+
"required": true,
|
|
13333
|
+
"hasDynamicHelp": false,
|
|
13334
|
+
"multiple": false,
|
|
13335
|
+
"type": "option"
|
|
13336
|
+
}
|
|
13337
|
+
},
|
|
13338
|
+
"hasDynamicHelp": false,
|
|
13339
|
+
"hiddenAliases": [],
|
|
13340
|
+
"id": "pg:upgrade:prepare",
|
|
13341
|
+
"pluginAlias": "heroku",
|
|
13342
|
+
"pluginName": "heroku",
|
|
13343
|
+
"pluginType": "core",
|
|
13344
|
+
"strict": true,
|
|
13345
|
+
"topic": "pg",
|
|
13346
|
+
"isESM": false,
|
|
13347
|
+
"relativePath": [
|
|
13348
|
+
"lib",
|
|
13349
|
+
"commands",
|
|
13350
|
+
"pg",
|
|
13351
|
+
"upgrade",
|
|
13352
|
+
"prepare.js"
|
|
13353
|
+
]
|
|
13354
|
+
},
|
|
13355
|
+
"pg:upgrade:run": {
|
|
13356
|
+
"aliases": [],
|
|
13357
|
+
"args": {
|
|
13358
|
+
"database": {
|
|
13359
|
+
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL.",
|
|
13360
|
+
"name": "database"
|
|
13361
|
+
}
|
|
13362
|
+
},
|
|
13363
|
+
"description": "starts a Postgres version upgrade\n\nOn Essential-tier databases, this command upgrades the database's Postgres version.\n\nOn Standard-tier and higher leader databases, this command runs a previously scheduled Postgres version upgrade. You must run pg:upgrade:prepare before this command to schedule a version upgrade.\n\nOn follower databases, this command unfollows the leader database before upgrading the follower's Postgres version.\n",
|
|
13364
|
+
"examples": [
|
|
13365
|
+
"# Upgrade an Essential-tier database to a specific version\n$ heroku pg:upgrade:run postgresql-curved-12345 --version 14 --app myapp\n",
|
|
13366
|
+
"# Upgrade a Standard-tier follower database to the latest supported version\n$ heroku pg:upgrade:run HEROKU_POSTGRESQL_BLUE_URL --app myapp\n",
|
|
13367
|
+
"# Run a previously scheduled upgrade on a Standard-tier leader database\n$ heroku pg:upgrade:run DATABASE_URL --app myapp\n"
|
|
13368
|
+
],
|
|
13369
|
+
"flags": {
|
|
13370
|
+
"confirm": {
|
|
13371
|
+
"char": "c",
|
|
13372
|
+
"name": "confirm",
|
|
13373
|
+
"hasDynamicHelp": false,
|
|
13374
|
+
"multiple": false,
|
|
13375
|
+
"type": "option"
|
|
13376
|
+
},
|
|
13377
|
+
"version": {
|
|
13378
|
+
"char": "v",
|
|
13379
|
+
"description": "Postgres version to upgrade to",
|
|
13380
|
+
"name": "version",
|
|
13381
|
+
"hasDynamicHelp": false,
|
|
13382
|
+
"multiple": false,
|
|
13383
|
+
"type": "option"
|
|
13384
|
+
},
|
|
13385
|
+
"app": {
|
|
13386
|
+
"char": "a",
|
|
13387
|
+
"description": "app to run command against",
|
|
13388
|
+
"name": "app",
|
|
13389
|
+
"required": true,
|
|
13390
|
+
"hasDynamicHelp": false,
|
|
13391
|
+
"multiple": false,
|
|
13392
|
+
"type": "option"
|
|
13393
|
+
},
|
|
13394
|
+
"remote": {
|
|
13395
|
+
"char": "r",
|
|
13396
|
+
"description": "git remote of app to use",
|
|
13397
|
+
"name": "remote",
|
|
13398
|
+
"hasDynamicHelp": false,
|
|
13399
|
+
"multiple": false,
|
|
13400
|
+
"type": "option"
|
|
13401
|
+
}
|
|
13402
|
+
},
|
|
13403
|
+
"hasDynamicHelp": false,
|
|
13404
|
+
"hiddenAliases": [],
|
|
13405
|
+
"id": "pg:upgrade:run",
|
|
13406
|
+
"pluginAlias": "heroku",
|
|
13407
|
+
"pluginName": "heroku",
|
|
13408
|
+
"pluginType": "core",
|
|
13409
|
+
"strict": true,
|
|
13410
|
+
"topic": "pg",
|
|
13411
|
+
"isESM": false,
|
|
13412
|
+
"relativePath": [
|
|
13413
|
+
"lib",
|
|
13414
|
+
"commands",
|
|
13415
|
+
"pg",
|
|
13416
|
+
"upgrade",
|
|
13417
|
+
"run.js"
|
|
13418
|
+
]
|
|
13419
|
+
},
|
|
13420
|
+
"pg:upgrade:wait": {
|
|
13421
|
+
"aliases": [],
|
|
13422
|
+
"args": {
|
|
13423
|
+
"database": {
|
|
13424
|
+
"description": "config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`",
|
|
13425
|
+
"name": "database"
|
|
13426
|
+
}
|
|
13427
|
+
},
|
|
13428
|
+
"description": "provides the status of an upgrade and blocks it until the operation is complete",
|
|
13429
|
+
"examples": [
|
|
13430
|
+
"# Wait for upgrade to complete with default settings\n$ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp\n",
|
|
13431
|
+
"# Wait with custom polling interval\n$ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --wait-interval 10\n",
|
|
13432
|
+
"# Wait without showing OS notifications\n$ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --no-notify\n"
|
|
13433
|
+
],
|
|
13434
|
+
"flags": {
|
|
13435
|
+
"wait-interval": {
|
|
13436
|
+
"description": "how frequently to poll in seconds (to avoid rate limiting)",
|
|
13437
|
+
"name": "wait-interval",
|
|
13438
|
+
"hasDynamicHelp": false,
|
|
13439
|
+
"multiple": false,
|
|
13440
|
+
"type": "option"
|
|
13441
|
+
},
|
|
13442
|
+
"no-notify": {
|
|
13443
|
+
"description": "do not show OS notification",
|
|
13444
|
+
"name": "no-notify",
|
|
13445
|
+
"allowNo": false,
|
|
13446
|
+
"type": "boolean"
|
|
13447
|
+
},
|
|
13448
|
+
"app": {
|
|
13449
|
+
"char": "a",
|
|
13450
|
+
"description": "app to run command against",
|
|
13451
|
+
"name": "app",
|
|
13452
|
+
"required": true,
|
|
13453
|
+
"hasDynamicHelp": false,
|
|
13454
|
+
"multiple": false,
|
|
13455
|
+
"type": "option"
|
|
13456
|
+
},
|
|
13457
|
+
"remote": {
|
|
13458
|
+
"char": "r",
|
|
13459
|
+
"description": "git remote of app to use",
|
|
13460
|
+
"name": "remote",
|
|
13461
|
+
"hasDynamicHelp": false,
|
|
13462
|
+
"multiple": false,
|
|
13463
|
+
"type": "option"
|
|
13464
|
+
}
|
|
13465
|
+
},
|
|
13466
|
+
"hasDynamicHelp": false,
|
|
13467
|
+
"hiddenAliases": [],
|
|
13468
|
+
"id": "pg:upgrade:wait",
|
|
13469
|
+
"pluginAlias": "heroku",
|
|
13470
|
+
"pluginName": "heroku",
|
|
13471
|
+
"pluginType": "core",
|
|
13472
|
+
"strict": true,
|
|
13473
|
+
"topic": "pg",
|
|
13474
|
+
"isESM": false,
|
|
13475
|
+
"relativePath": [
|
|
13476
|
+
"lib",
|
|
13477
|
+
"commands",
|
|
13478
|
+
"pg",
|
|
13479
|
+
"upgrade",
|
|
13480
|
+
"wait.js"
|
|
13481
|
+
]
|
|
13482
|
+
},
|
|
13206
13483
|
"ps:autoscale:disable": {
|
|
13207
13484
|
"aliases": [],
|
|
13208
13485
|
"args": {},
|
|
@@ -14652,5 +14929,5 @@
|
|
|
14652
14929
|
]
|
|
14653
14930
|
}
|
|
14654
14931
|
},
|
|
14655
|
-
"version": "10.
|
|
14932
|
+
"version": "10.8.0-alpha.0"
|
|
14656
14933
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heroku",
|
|
3
3
|
"description": "CLI to interact with Heroku",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.8.0-alpha.0",
|
|
5
5
|
"author": "Heroku",
|
|
6
6
|
"bin": "./bin/run",
|
|
7
7
|
"bugs": "https://github.com/heroku/cli/issues",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@heroku-cli/schema": "^1.0.25",
|
|
14
14
|
"@heroku/buildpack-registry": "^1.0.1",
|
|
15
15
|
"@heroku/eventsource": "^1.0.7",
|
|
16
|
-
"@heroku/heroku-cli-util": "^9.0.
|
|
16
|
+
"@heroku/heroku-cli-util": "^9.0.2",
|
|
17
17
|
"@heroku/http-call": "^5.4.0",
|
|
18
18
|
"@heroku/plugin-ai": "^1.0.1",
|
|
19
19
|
"@inquirer/prompts": "^5.0.5",
|
|
@@ -398,5 +398,5 @@
|
|
|
398
398
|
"version": "oclif readme --multi && git add README.md ../../docs"
|
|
399
399
|
},
|
|
400
400
|
"types": "lib/index.d.ts",
|
|
401
|
-
"gitHead": "
|
|
401
|
+
"gitHead": "1a4f0898d75477fd3e1bce18341fb6cbc09f2af1"
|
|
402
402
|
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const core_1 = require("@oclif/core");
|
|
6
|
-
const tsheredoc_1 = require("tsheredoc");
|
|
7
|
-
const fetcher_1 = require("../../lib/pg/fetcher");
|
|
8
|
-
const host_1 = require("../../lib/pg/host");
|
|
9
|
-
const util_1 = require("../../lib/pg/util");
|
|
10
|
-
const confirmCommand_1 = require("../../lib/confirmCommand");
|
|
11
|
-
const nls_1 = require("../../nls");
|
|
12
|
-
class Upgrade extends command_1.Command {
|
|
13
|
-
async run() {
|
|
14
|
-
const { flags, args } = await this.parse(Upgrade);
|
|
15
|
-
const { app, version, confirm } = flags;
|
|
16
|
-
const { database } = args;
|
|
17
|
-
const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
|
|
18
|
-
if ((0, util_1.legacyEssentialPlan)(db))
|
|
19
|
-
core_1.ux.error('pg:upgrade is only available for Essential-* databases and follower databases on Standard-tier and higher plans.');
|
|
20
|
-
const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
|
|
21
|
-
if (replica.following) {
|
|
22
|
-
const { body: configVars } = await this.heroku.get(`/apps/${app}/config-vars`);
|
|
23
|
-
const origin = (0, util_1.databaseNameFromUrl)(replica.following, configVars);
|
|
24
|
-
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
25
|
-
Destructive action
|
|
26
|
-
${color_1.default.addon(db.name)} will be upgraded to a newer PostgreSQL version, stop following ${origin}, and become writable.
|
|
27
|
-
|
|
28
|
-
This cannot be undone.
|
|
29
|
-
`));
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
|
|
33
|
-
Destructive action
|
|
34
|
-
${color_1.default.addon(db.name)} will be upgraded to a newer PostgreSQL version.
|
|
35
|
-
|
|
36
|
-
This cannot be undone.
|
|
37
|
-
`));
|
|
38
|
-
}
|
|
39
|
-
const data = { version };
|
|
40
|
-
core_1.ux.action.start(`Starting upgrade of ${color_1.default.addon(db.name)}`);
|
|
41
|
-
await this.heroku.post(`/client/v11/databases/${db.id}/upgrade`, { hostname: (0, host_1.default)(), body: data });
|
|
42
|
-
core_1.ux.action.stop(`Use ${color_1.default.cmd('heroku pg:wait')} to track status`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.default = Upgrade;
|
|
46
|
-
Upgrade.topic = 'pg';
|
|
47
|
-
Upgrade.description = (0, tsheredoc_1.default)(`
|
|
48
|
-
For an Essential-* plan, this command upgrades the database's PostgreSQL version. For a Standard-tier and higher plan, this command unfollows the leader database before upgrading the PostgreSQL version.
|
|
49
|
-
To upgrade to another PostgreSQL version, use pg:copy instead
|
|
50
|
-
`);
|
|
51
|
-
Upgrade.flags = {
|
|
52
|
-
confirm: command_1.flags.string({ char: 'c' }),
|
|
53
|
-
version: command_1.flags.string({ char: 'v', description: 'PostgreSQL version to upgrade to' }),
|
|
54
|
-
app: command_1.flags.app({ required: true }),
|
|
55
|
-
remote: command_1.flags.remote(),
|
|
56
|
-
};
|
|
57
|
-
Upgrade.args = {
|
|
58
|
-
database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
|
|
59
|
-
};
|
|
File without changes
|