From 4a3fb7ad6ee889f14797da12fac159c53d3a1216 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Thu, 2 Jul 2026 11:19:53 +0200 Subject: [PATCH 1/3] feat(app): add commands to link, unlink and replace an app's database Adds `mw app database link | unlink | replace` so managing an app installation's linked database no longer requires calling the raw HTTP API. - `link` wraps the `app-link-database` operation and always sends `databaseUserIds.admin`, which the API requires in practice. - `unlink` wraps `app-unlink-database`. - `replace` wraps `app-replace-database`. Closes #1969 Co-Authored-By: Claude Opus 4.8 --- docs/app.md | 156 ++++++++++++++++++++++++ src/commands/app/database/link.tsx | 80 ++++++++++++ src/commands/app/database/replace.tsx | 85 +++++++++++++ src/commands/app/database/unlink.ts | 43 +++++++ src/lib/resources/app/database/flags.ts | 17 +++ 5 files changed, 381 insertions(+) create mode 100644 src/commands/app/database/link.tsx create mode 100644 src/commands/app/database/replace.tsx create mode 100644 src/commands/app/database/unlink.ts create mode 100644 src/lib/resources/app/database/flags.ts diff --git a/docs/app.md b/docs/app.md index 0b5b7e11c..d973f8cf5 100644 --- a/docs/app.md +++ b/docs/app.md @@ -9,6 +9,9 @@ Manage apps, and app installations in your projects * [`mw app create php-worker`](#mw-app-create-php-worker) * [`mw app create python`](#mw-app-create-python) * [`mw app create static`](#mw-app-create-static) +* [`mw app database link [INSTALLATION-ID]`](#mw-app-database-link-installation-id) +* [`mw app database replace [INSTALLATION-ID]`](#mw-app-database-replace-installation-id) +* [`mw app database unlink [INSTALLATION-ID]`](#mw-app-database-unlink-installation-id) * [`mw app dependency list`](#mw-app-dependency-list) * [`mw app dependency update [INSTALLATION-ID]`](#mw-app-dependency-update-installation-id) * [`mw app dependency versions SYSTEMSOFTWARE`](#mw-app-dependency-versions-systemsoftware) @@ -411,6 +414,159 @@ FLAG DESCRIPTIONS ``` +## `mw app database link [INSTALLATION-ID]` + +Link a database to an app installation. + +``` +USAGE + $ mw app database link [INSTALLATION-ID] --database-id --purpose primary|cache|custom --admin-user-id + [--token ] [-q] + +ARGUMENTS + [INSTALLATION-ID] ID or short ID of an app installation; this argument is optional if a default app installation is + set in the context. + +FLAGS + -q, --quiet suppress process output and only display a machine-readable summary + --admin-user-id= (required) the ID of the database user to link as the administrative user. + --database-id= (required) the ID of the database to link to the app installation. + --purpose=