postgresai 0.18.0-dev.6 → 0.18.0-dev.7

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/README.md CHANGED
@@ -208,29 +208,6 @@ machine instead. When stdout is not a terminal the result is JSON with `status`,
208
208
  `dashboard_url` and `next`. Then: `pgai mon instances list`, `pgai mon instances watch <id-or-name>`, `pgai mon instances delete <id-or-name>`,
209
209
  and `pgai mon instances set <id-or-name> --vcpus <n>` to add or change the database server's vCPUs later (an org admin; AAS starts within a minute).
210
210
 
211
- To use a direct PostgreSQL connection, explicitly select `--provider generic`:
212
-
213
- ```bash
214
- pgai mon deploy "$DATABASE_URL" --provider generic --org <alias> --json --no-wait
215
- ```
216
-
217
- This is the existing `--provider self-managed` path under a clearer name; both spellings work,
218
- and the result's `provider` remains `self-managed` for compatibility. It works with any reachable
219
- PostgreSQL endpoint where the supplied user can create the monitoring role and grant privileges.
220
- Use a direct endpoint, not a pooler.
221
-
222
- The endpoint must be reachable from this machine, which prepares the database, and from
223
- PostgresAI. Before provisioning, PostgresAI tests the connection from its platform, whose
224
- address is not published, so the port must accept connections from the internet at that point.
225
- After provisioning, the monitoring server connects from its own IP address, shown on its page in
226
- the Console (Monitoring, then the instance). A database that must stay behind an IP allowlist
227
- needs AWS PrivateLink (RDS) or self-hosted monitoring (`--self-hosted`).
228
-
229
- Without `--provider`, RDS and Supabase hostnames still go to their console integration.
230
- `generic` does not configure AWS PrivateLink, open a firewall, or remove TLS, permission, or
231
- payment checks. A private endpoint needs a network path, or monitoring hosted in that network
232
- (`--self-hosted`).
233
-
234
211
  `pgai mon deploy` and `pgai dblab deploy` share their options and results: the database URL as the
235
212
  argument (or `--db-url`), `--name` (default: from the database), `--location` (a Hetzner location;
236
213
  default: any with capacity), `--wait <minutes>` / `--no-wait`, `--yes` (never prompt), `--json`, the
@@ -252,7 +229,7 @@ terminal, or with `--json`, it only points to `pgai mon deploy`.
252
229
 
253
230
  | Option | |
254
231
  |---|---|
255
- | `--provider <provider>` | `generic` (direct PostgreSQL; `self-managed` remains an alias), `clickhouse`, `rds` or `supabase`; default: detected from the host |
232
+ | `--provider <provider>` | `clickhouse`, `rds`, `supabase` or `self-managed`; default: detected from the host |
256
233
  | `--clickhouse-key <key-id>:<key-secret>` | ClickHouse Cloud API key, for CPU, memory and disk |
257
234
  | `--self-hosted` | run the stack on this machine (`mon local-install`) instead of PostgresAI Cloud |
258
235
  | `--reset-password` | `postgres_ai_mon` exists and its password is lost: set a new one (see below) |
@@ -427,9 +404,8 @@ PGPASSWORD=<password> pgai dblab deploy 'postgresql://<user>@<host>:5432/<db>' -
427
404
  ```
428
405
 
429
406
  The same options as `pgai mon deploy` (`--db-url`, `--name`, `--location`, `--wait`, `--no-wait`, `--yes`, `--json`),
430
- plus `--size S|M|L` (default `S`), `--disk <GiB>` (default 50), `--ssh-key` (required: one of the organization's
431
- SSH keys, for reaching the server and its clones) and `--provider generic|rds|supabase` (default: detected; `self-managed`
432
- remains an alias of `generic`). `--name` defaults to the database's name; `--wait` to 120 minutes.
407
+ plus `--size S|M|L` (default `S`), `--disk <GiB>` (default 50) and `--ssh-key` (required: one of the organization's
408
+ SSH keys, for reaching the server and its clones). `--name` defaults to the database's name; `--wait` to 120 minutes.
433
409
  It shows the estimated monthly cost before asking; with no payment method it stops with the billing page (exit 3).
434
410
  `pgai dblab instances list | watch (status) | delete` take an id or a name.
435
411
 
@@ -13533,7 +13533,7 @@ var {
13533
13533
  // package.json
13534
13534
  var package_default = {
13535
13535
  name: "postgresai",
13536
- version: "0.18.0-dev.6",
13536
+ version: "0.18.0-dev.7",
13537
13537
  description: "postgres_ai CLI",
13538
13538
  license: "Apache-2.0",
13539
13539
  private: false,
@@ -16893,7 +16893,7 @@ var Result = import_lib.default.Result;
16893
16893
  var TypeOverrides = import_lib.default.TypeOverrides;
16894
16894
  var defaults = import_lib.default.defaults;
16895
16895
  // package.json
16896
- var version = "0.18.0-dev.6";
16896
+ var version = "0.18.0-dev.7";
16897
16897
  var package_default2 = {
16898
16898
  name: "postgresai",
16899
16899
  version,
@@ -28229,13 +28229,9 @@ function priceText(q) {
28229
28229
  }
28230
28230
  return base;
28231
28231
  }
28232
- var FIRST_CHECKUP_DELAY_MS = 30 * 60000;
28232
+ var FIRST_CHECKUP_DELAY_MS = 3 * 60000;
28233
28233
  var POLL_MS = 15000;
28234
28234
  var PROVIDERS = ["clickhouse", "rds", "supabase", "self-managed"];
28235
- var providerArg = (provider) => {
28236
- const p = provider?.trim().toLowerCase();
28237
- return p === "generic" ? "self-managed" : p;
28238
- };
28239
28235
  function parseUrl(url) {
28240
28236
  try {
28241
28237
  return new URL(url);
@@ -28448,9 +28444,9 @@ async function billingFor(q, name, opts, deps, show) {
28448
28444
  async function connect(url, opts, deps) {
28449
28445
  const started = deps.now();
28450
28446
  const progress = (event, message, more = {}) => deps.progress({ event, elapsed_s: Math.round((deps.now() - started) / 1000), message, ...more });
28451
- const provider = providerArg(opts.provider) ?? detectCloudProvider(url);
28447
+ const provider = opts.provider ?? detectCloudProvider(url);
28452
28448
  if (!PROVIDERS.includes(provider))
28453
- throw new Error(`--provider must be one of: generic, ${PROVIDERS.join(", ")}`);
28449
+ throw new Error(`--provider must be one of: ${PROVIDERS.join(", ")}`);
28454
28450
  assertEncodedUserinfo(url);
28455
28451
  checkUrlParams(url, opts.agent);
28456
28452
  const name = databaseName2(url);
@@ -36300,7 +36296,7 @@ async function startMcpServer(rootOpts, extra) {
36300
36296
  properties: {
36301
36297
  ...ORG_ID_TOOL_PROPERTY,
36302
36298
  database_url: { type: "string", description: "postgresql:// URL with the password in it (admin, or the postgres_ai_mon role)" },
36303
- provider: { type: "string", description: "generic (direct PostgreSQL URL; alias: self-managed) | clickhouse | rds | supabase (default: detected from the host)" },
36299
+ provider: { type: "string", description: "clickhouse | rds | supabase | self-managed (default: detected from the host)" },
36304
36300
  clickhouse_key: { type: "string", description: "ClickHouse Cloud API key as <key-id>:<key-secret> (Basic Service API Reader), for CPU, memory and disk" },
36305
36301
  yes: { type: "boolean", description: "Accept the price of a billed box. Without it, a billed box is not provisioned: the result has status action_required and the price; ask the user, then call again with yes: true" },
36306
36302
  coupon: { type: "string", description: "Stripe promotion code for the organization's monitoring subscription (applies when it is first created)" },
@@ -37232,13 +37228,9 @@ function priceText2(q) {
37232
37228
  }
37233
37229
  return base;
37234
37230
  }
37235
- var FIRST_CHECKUP_DELAY_MS2 = 30 * 60000;
37231
+ var FIRST_CHECKUP_DELAY_MS2 = 3 * 60000;
37236
37232
  var POLL_MS2 = 15000;
37237
37233
  var PROVIDERS2 = ["clickhouse", "rds", "supabase", "self-managed"];
37238
- var providerArg2 = (provider) => {
37239
- const p = provider?.trim().toLowerCase();
37240
- return p === "generic" ? "self-managed" : p;
37241
- };
37242
37234
  function parseUrl2(url) {
37243
37235
  try {
37244
37236
  return new URL(url);
@@ -37511,9 +37503,9 @@ async function billingFor2(q, name, opts, deps, show) {
37511
37503
  async function connect2(url, opts, deps) {
37512
37504
  const started = deps.now();
37513
37505
  const progress = (event, message, more = {}) => deps.progress({ event, elapsed_s: Math.round((deps.now() - started) / 1000), message, ...more });
37514
- const provider = providerArg2(opts.provider) ?? detectCloudProvider2(url);
37506
+ const provider = opts.provider ?? detectCloudProvider2(url);
37515
37507
  if (!PROVIDERS2.includes(provider))
37516
- throw new Error(`--provider must be one of: generic, ${PROVIDERS2.join(", ")}`);
37508
+ throw new Error(`--provider must be one of: ${PROVIDERS2.join(", ")}`);
37517
37509
  assertEncodedUserinfo(url);
37518
37510
  checkUrlParams2(url, opts.agent);
37519
37511
  const name = databaseName3(url);
@@ -39033,7 +39025,7 @@ function withEnvPassword(dbUrl, env = process.env) {
39033
39025
  u.password = encodeURIComponent(pw);
39034
39026
  return u.toString();
39035
39027
  }
39036
- var DBLAB_PROVIDERS = ["generic", "rds", "supabase", "self-managed"];
39028
+ var DBLAB_PROVIDERS = ["rds", "supabase", "self-managed"];
39037
39029
  var DBLAB_CLOUDS = ["hetzner", "aws", "gcp"];
39038
39030
  var CLOUD_NAMES = { hetzner: "Hetzner", aws: "AWS", gcp: "Google Cloud" };
39039
39031
  var cloudName = (cloud) => CLOUD_NAMES[cloud ?? "hetzner"] ?? String(cloud);
@@ -39468,7 +39460,7 @@ function failureSummary(error) {
39468
39460
  }
39469
39461
  function registerDblabDeployCommands(dblab, deps) {
39470
39462
  const tty = deps.isTty ?? isTtyDefault;
39471
- sharedDeployOptions(deps.withOrgOptions(dblab.command("deploy")), 120, "instance name: lowercase letters, digits, hyphens (default: from the database's name)", "Hetzner location: fsn1, nbg1 or hel1 (default: any with capacity); with --cloud aws or gcp, a region " + "(default: the source's region, else us-east-1 / us-central1)").description("deploy DBLab + Joe in PostgresAI cloud, then follow it until it is ready").option("--size <size>", "server size (S, M, L)", "S").option("--disk <gib>", "disk size in GiB", "50").option("--ssh-key <name|id...>", "org SSH key(s) for reaching the server and its clones (required)").option("--provider <provider>", "where the database runs: generic (direct PostgreSQL URL; alias: self-managed), rds or supabase (default: detected)").option("--cloud <cloud>", "where the DBLab server runs: hetzner, aws or gcp (default: hetzner); --location is then its region").addHelpText("after", [
39463
+ sharedDeployOptions(deps.withOrgOptions(dblab.command("deploy")), 120, "instance name: lowercase letters, digits, hyphens (default: from the database's name)", "Hetzner location: fsn1, nbg1 or hel1 (default: any with capacity); with --cloud aws or gcp, a region " + "(default: the source's region, else us-east-1 / us-central1)").description("deploy DBLab + Joe in PostgresAI cloud, then follow it until it is ready").option("--size <size>", "server size (S, M, L)", "S").option("--disk <gib>", "disk size in GiB", "50").option("--ssh-key <name|id...>", "org SSH key(s) for reaching the server and its clones (required)").option("--provider <provider>", "where the database runs: rds, supabase or self-managed (default: detected)").option("--cloud <cloud>", "where the DBLab server runs: hetzner, aws or gcp (default: hetzner); --location is then its region").addHelpText("after", [
39472
39464
  "",
39473
39465
  "The password: in the URL, or set PGPASSWORD.",
39474
39466
  "A Supabase project without its password: deploy it from the Console (Connect Supabase).",
@@ -40686,10 +40678,8 @@ function detectProvider(conn) {
40686
40678
  }
40687
40679
  }
40688
40680
  function resolveProvider(explicit, conn) {
40689
- if (explicit !== undefined) {
40690
- const p = explicit.trim().toLowerCase();
40691
- return { provider: p === "generic" ? "self-managed" : p, detected: false };
40692
- }
40681
+ if (explicit !== undefined)
40682
+ return { provider: explicit, detected: false };
40693
40683
  const provider = conn === undefined ? null : detectProvider(conn);
40694
40684
  return { provider: provider ?? "self-managed", detected: provider !== null };
40695
40685
  }
@@ -46495,7 +46485,7 @@ program2.command("set-storage-url <url>").description("store storage base URL fo
46495
46485
  process.exitCode = 1;
46496
46486
  }
46497
46487
  });
46498
- program2.command("prepare-db [conn]").description("prepare database for monitoring: create monitoring user, required view(s), and grant permissions (idempotent)").option("--db-url <url>", "PostgreSQL connection URL (admin) to run the setup against (deprecated; pass it as positional arg, or PGAI_DB_URL)").option("-h, --host <host>", "PostgreSQL host (psql-like)").option("-p, --port <port>", "PostgreSQL port (psql-like)").option("-U, --username <username>", "PostgreSQL user (psql-like)").option("-d, --dbname <dbname>", "PostgreSQL database name (psql-like)").option("--admin-password <password>", "Admin connection password (otherwise uses PGPASSWORD if set)").option("--monitoring-user <name>", "Monitoring role name to create/update", DEFAULT_MONITORING_USER2).option("--password <password>", "Monitoring role password (overrides PGAI_MON_PASSWORD)").option("--skip-optional-permissions", "Skip optional permissions (RDS/self-managed extras)", false).option("--provider <provider>", "Database provider: generic (alias: self-managed), supabase or clickhouse. Affects which steps are executed.").option("--verify", "Verify that monitoring role/permissions are in place (no changes)", false).option("--reset-password", "Reset monitoring role password only (no other changes)", false).option("--print-sql", "Print SQL plan and exit (no changes applied)", false).option("--print-password", "Print generated monitoring password (DANGEROUS in CI logs)", false).option("--supabase", "Use Supabase Management API instead of direct PostgreSQL connection", false).option("--supabase-access-token <token>", "Supabase Management API access token (or SUPABASE_ACCESS_TOKEN env)").option("--supabase-project-ref <ref>", "Supabase project reference (or SUPABASE_PROJECT_REF env)").option("--json", "Output result as JSON (machine-readable)", false).addHelpText("after", [
46488
+ program2.command("prepare-db [conn]").description("prepare database for monitoring: create monitoring user, required view(s), and grant permissions (idempotent)").option("--db-url <url>", "PostgreSQL connection URL (admin) to run the setup against (deprecated; pass it as positional arg, or PGAI_DB_URL)").option("-h, --host <host>", "PostgreSQL host (psql-like)").option("-p, --port <port>", "PostgreSQL port (psql-like)").option("-U, --username <username>", "PostgreSQL user (psql-like)").option("-d, --dbname <dbname>", "PostgreSQL database name (psql-like)").option("--admin-password <password>", "Admin connection password (otherwise uses PGPASSWORD if set)").option("--monitoring-user <name>", "Monitoring role name to create/update", DEFAULT_MONITORING_USER2).option("--password <password>", "Monitoring role password (overrides PGAI_MON_PASSWORD)").option("--skip-optional-permissions", "Skip optional permissions (RDS/self-managed extras)", false).option("--provider <provider>", "Database provider (e.g., supabase, clickhouse). Affects which steps are executed.").option("--verify", "Verify that monitoring role/permissions are in place (no changes)", false).option("--reset-password", "Reset monitoring role password only (no other changes)", false).option("--print-sql", "Print SQL plan and exit (no changes applied)", false).option("--print-password", "Print generated monitoring password (DANGEROUS in CI logs)", false).option("--supabase", "Use Supabase Management API instead of direct PostgreSQL connection", false).option("--supabase-access-token <token>", "Supabase Management API access token (or SUPABASE_ACCESS_TOKEN env)").option("--supabase-project-ref <ref>", "Supabase project reference (or SUPABASE_PROJECT_REF env)").option("--json", "Output result as JSON (machine-readable)", false).addHelpText("after", [
46499
46489
  "",
46500
46490
  "Examples:",
46501
46491
  " postgresai prepare-db postgresql://admin@host:5432/dbname",
@@ -47187,7 +47177,7 @@ program2.command("prepare-db [conn]").description("prepare database for monitori
47187
47177
  }
47188
47178
  }
47189
47179
  });
47190
- program2.command("unprepare-db [conn]").description("remove monitoring setup: drop monitoring user, views, schema, and revoke permissions").option("--db-url <url>", "PostgreSQL connection URL (admin) (deprecated; pass it as positional arg)").option("-h, --host <host>", "PostgreSQL host (psql-like)").option("-p, --port <port>", "PostgreSQL port (psql-like)").option("-U, --username <username>", "PostgreSQL user (psql-like)").option("-d, --dbname <dbname>", "PostgreSQL database name (psql-like)").option("--admin-password <password>", "Admin connection password (otherwise uses PGPASSWORD if set)").option("--monitoring-user <name>", "Monitoring role name to remove", DEFAULT_MONITORING_USER2).option("--keep-role", "Keep the monitoring role (only revoke permissions and drop objects)", false).option("--provider <provider>", "Database provider: generic (alias: self-managed), supabase or clickhouse. Affects which steps are executed.").option("--print-sql", "Print SQL plan and exit (no changes applied)", false).option("--force", "Skip confirmation prompt", false).option("--json", "Output result as JSON (machine-readable)", false).addHelpText("after", [
47180
+ program2.command("unprepare-db [conn]").description("remove monitoring setup: drop monitoring user, views, schema, and revoke permissions").option("--db-url <url>", "PostgreSQL connection URL (admin) (deprecated; pass it as positional arg)").option("-h, --host <host>", "PostgreSQL host (psql-like)").option("-p, --port <port>", "PostgreSQL port (psql-like)").option("-U, --username <username>", "PostgreSQL user (psql-like)").option("-d, --dbname <dbname>", "PostgreSQL database name (psql-like)").option("--admin-password <password>", "Admin connection password (otherwise uses PGPASSWORD if set)").option("--monitoring-user <name>", "Monitoring role name to remove", DEFAULT_MONITORING_USER2).option("--keep-role", "Keep the monitoring role (only revoke permissions and drop objects)", false).option("--provider <provider>", "Database provider (e.g., supabase, clickhouse). Affects which steps are executed.").option("--print-sql", "Print SQL plan and exit (no changes applied)", false).option("--force", "Skip confirmation prompt", false).option("--json", "Output result as JSON (machine-readable)", false).addHelpText("after", [
47191
47181
  "",
47192
47182
  "Examples:",
47193
47183
  " postgresai unprepare-db postgresql://admin@host:5432/dbname",
@@ -48037,13 +48027,21 @@ async function selfRegisterAndPersist(projectDir, apiKey, projectName, opts, reg
48037
48027
  process.exitCode = 1;
48038
48028
  return reg;
48039
48029
  }
48040
- async function applyMonitoringTargetsConfig() {
48030
+ async function applyMonitoringTargetsConfig(restartReporter = false) {
48041
48031
  console.log("Applying monitoring target configuration...");
48042
48032
  const generateCode = await runCompose(["run", "--rm", "sources-generator"]);
48043
48033
  if (generateCode !== 0)
48044
48034
  return generateCode;
48045
48035
  console.log("Restarting pgwatch collectors to pick up target changes...");
48046
- return runCompose(["up", "-d", "--force-recreate", "pgwatch-prometheus", "pgwatch-postgres"]);
48036
+ const upCode = await runCompose(["up", "-d", "--force-recreate", "pgwatch-prometheus", "pgwatch-postgres"]);
48037
+ if (upCode !== 0)
48038
+ return upCode;
48039
+ if (!restartReporter)
48040
+ return 0;
48041
+ if (await runCompose(["restart", "postgres-reports"]) !== 0) {
48042
+ console.error("\u26A0 Could not restart postgres-reports; the target's first report comes with its next daily run");
48043
+ }
48044
+ return 0;
48047
48045
  }
48048
48046
  async function runCompose(args, grafanaPassword, extraEnv) {
48049
48047
  let composeFile;
@@ -48348,8 +48346,7 @@ async function runConnect(urlArg, opts) {
48348
48346
  if (!name || !/^postgres(ql)?:\/\//.test(url)) {
48349
48347
  return emitConnect({ status: "failed", provider: "self-managed", name, next: "Pass a URL: pgai mon deploy postgresql://user:password@host:5432/dbname" }, opts.json);
48350
48348
  }
48351
- const explicit = providerArg2(opts.provider);
48352
- const provider = PROVIDERS2.find((p) => p === explicit) ?? detectCloudProvider2(url);
48349
+ const provider = PROVIDERS2.find((p) => p === opts.provider) ?? detectCloudProvider2(url);
48353
48350
  let minutes;
48354
48351
  try {
48355
48352
  minutes = waitMinutes2(opts.wait, 20);
@@ -48477,18 +48474,13 @@ Cancelling: nothing has been created yet (Ctrl-C again to quit now).`);
48477
48474
  }
48478
48475
  }
48479
48476
  var mon = program2.command("mon").description("monitoring services management");
48480
- sharedDeployOptions2(withOrgOptions(mon.command("deploy")), 20, "instance name (default: host[:port]/database)").description("deploy PostgresAI Cloud monitoring for a database: prepare it, provision the monitoring box, print its Health Matrix and dashboard").option("--provider <provider>", "generic (direct PostgreSQL URL; alias: self-managed) | clickhouse | rds | supabase (default: detected from the host)").option("--clickhouse-key <id:secret>", "ClickHouse Cloud API key (Basic Service API Reader) for CPU, memory and disk; or CLICKHOUSE_KEY_ID + CLICKHOUSE_KEY_SECRET").option("--self-hosted", "run the monitoring stack on this machine (mon local-install) instead of PostgresAI Cloud").option("--reset-password", "postgres_ai_mon exists and its password is lost: set a new one (admin URL; refused while another database on the server is monitored)").option("--coupon <code>", "promotion code for the organization's monitoring subscription (applies when it is first created)").option("--vcpus <n>", "vCPUs of the database server; without it there is no AAS (database load) data (asked at a terminal)").addHelpText("after", [
48477
+ sharedDeployOptions2(withOrgOptions(mon.command("deploy")), 20, "instance name (default: host[:port]/database)").description("deploy PostgresAI Cloud monitoring for a database: prepare it, provision the monitoring box, print its Health Matrix and dashboard").option("--provider <provider>", "clickhouse | rds | supabase | self-managed (default: detected from the host)").option("--clickhouse-key <id:secret>", "ClickHouse Cloud API key (Basic Service API Reader) for CPU, memory and disk; or CLICKHOUSE_KEY_ID + CLICKHOUSE_KEY_SECRET").option("--self-hosted", "run the monitoring stack on this machine (mon local-install) instead of PostgresAI Cloud").option("--reset-password", "postgres_ai_mon exists and its password is lost: set a new one (admin URL; refused while another database on the server is monitored)").option("--coupon <code>", "promotion code for the organization's monitoring subscription (applies when it is first created)").option("--vcpus <n>", "vCPUs of the database server; without it there is no AAS (database load) data (asked at a terminal)").addHelpText("after", [
48481
48478
  "",
48482
48479
  "Steps (each skipped when already done; safe to re-run): sign in, prepare the database",
48483
48480
  "(an admin URL creates the postgres_ai_mon role; otherwise the SQL is printed), provision",
48484
48481
  "the monitoring box, run the express checkup while it starts, wait, print the Health Matrix",
48485
48482
  "(health_url) and Grafana, signed in with your PostgresAI account (dashboard_url).",
48486
48483
  "",
48487
- "Network: the database must be reachable from this machine and from PostgresAI. Before provisioning,",
48488
- "PostgresAI tests the connection from an unpublished address, so the port must accept connections",
48489
- "from the internet; after it, the monitoring box connects from the IP shown on its Console page.",
48490
- "Behind an IP allowlist, use AWS PrivateLink (RDS) or --self-hosted.",
48491
- "",
48492
48484
  "Billing is per Postgres cluster observed: another database in a cluster the organization already",
48493
48485
  'monitors is included. Once the URL is checked, deploy shows the price (or "free (N of M free slots)"). A billed',
48494
48486
  "box is provisioned only when accepted: at the prompt, or with --yes. With no payment method",
@@ -49739,7 +49731,7 @@ async function addTarget(file, projectDir, connStr, name, env, { apply = true, v
49739
49731
  }
49740
49732
  if (!apply)
49741
49733
  return true;
49742
- const applyCode = await applyMonitoringTargetsConfig();
49734
+ const applyCode = await applyMonitoringTargetsConfig(true);
49743
49735
  if (applyCode !== 0) {
49744
49736
  console.error("Monitoring target was saved, but applying the generated pgwatch sources failed. Run 'postgresai mon restart' to apply manually.");
49745
49737
  process.exitCode = 1;
@@ -7,10 +7,14 @@ grant connect on database {{DB_IDENT}} to {{ROLE_IDENT}};
7
7
  grant pg_monitor to {{ROLE_IDENT}};
8
8
  grant select on pg_catalog.pg_index to {{ROLE_IDENT}};
9
9
 
10
- -- Cluster-wide pg_stat_statements collection needs pg_read_all_stats (without it, other
11
- -- users' rows have queryid and query text redacted to NULL). pg_monitor includes it, so it
12
- -- is not granted directly: on PostgreSQL 16+ that needs ADMIN OPTION on pg_read_all_stats,
13
- -- which Supabase's `postgres` role does not have (it has ADMIN OPTION on pg_monitor only).
10
+ -- Required for cluster-wide pg_stat_statements collection.
11
+ -- pg_stat_statements is backed by shared memory and holds entries for every database
12
+ -- in the cluster, but a role without pg_read_all_stats sees other users' rows with
13
+ -- queryid and query text redacted to NULL -- which collapses the per-queryid grouping
14
+ -- in the pg_stat_statements metric. pg_monitor already implies pg_read_all_stats;
15
+ -- granting it explicitly documents the dependency and keeps the metric working if the
16
+ -- pg_monitor grant above is ever narrowed. Idempotent.
17
+ grant pg_read_all_stats to {{ROLE_IDENT}};
14
18
 
15
19
  -- Create postgres_ai schema for our objects
16
20
  -- Using IF NOT EXISTS for idempotency - prepare-db can be run multiple times
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgresai",
3
- "version": "0.18.0-dev.6",
3
+ "version": "0.18.0-dev.7",
4
4
  "description": "postgres_ai CLI",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -7,10 +7,14 @@ grant connect on database {{DB_IDENT}} to {{ROLE_IDENT}};
7
7
  grant pg_monitor to {{ROLE_IDENT}};
8
8
  grant select on pg_catalog.pg_index to {{ROLE_IDENT}};
9
9
 
10
- -- Cluster-wide pg_stat_statements collection needs pg_read_all_stats (without it, other
11
- -- users' rows have queryid and query text redacted to NULL). pg_monitor includes it, so it
12
- -- is not granted directly: on PostgreSQL 16+ that needs ADMIN OPTION on pg_read_all_stats,
13
- -- which Supabase's `postgres` role does not have (it has ADMIN OPTION on pg_monitor only).
10
+ -- Required for cluster-wide pg_stat_statements collection.
11
+ -- pg_stat_statements is backed by shared memory and holds entries for every database
12
+ -- in the cluster, but a role without pg_read_all_stats sees other users' rows with
13
+ -- queryid and query text redacted to NULL -- which collapses the per-queryid grouping
14
+ -- in the pg_stat_statements metric. pg_monitor already implies pg_read_all_stats;
15
+ -- granting it explicitly documents the dependency and keeps the metric working if the
16
+ -- pg_monitor grant above is ever narrowed. Idempotent.
17
+ grant pg_read_all_stats to {{ROLE_IDENT}};
14
18
 
15
19
  -- Create postgres_ai schema for our objects
16
20
  -- Using IF NOT EXISTS for idempotency - prepare-db can be run multiple times