Skip to content

No CLI command to link/unlink an app installation's database (API-only) #1969

Description

@Hermsi1337

Summary

Managing an app installation's linked database (link / unlink / repurpose / replace) is only possible via the raw HTTP API today — there is no mw subcommand for it. In otherwise CLI-driven workflows (e.g. migrations) this forces hand-rolled curl calls against the OpenAPI spec.

Verified against mw 1.19.0.

What's missing

mw app exposes no database-related subcommand:

app copy / download / exec / get / list / list-upgrade-candidates /
open / ssh / uninstall / update / upgrade / upload / version-info / versions

…but the API has a full set of app↔database operations:

Operation API endpoint (operationId)
Link a DB to an app PATCH /v2/app-installations/{id}/database (app-link-database)
Unlink a DB DELETE /v2/app-installations/{id}/databases/{databaseId} (app-unlink-database)
Replace the linked DB PATCH /v2/app-installations/{id}/database/replace (app-replace-database)
Set DB users PUT /v2/app-installations/{id}/databases/{databaseId}/users (app-set-database-users)

Why it hurts

The link body is non-obvious and easy to get wrong when hand-rolling:

PATCH /v2/app-installations/{id}/database
{ "databaseId": "<uuid>", "purpose": "primary|cache|custom", "databaseUserIds": { "admin": "<databaseUserId>" } }

Two sharp edges hit while doing it by hand:

  • databaseUserIds is required in practice (the call fails without databaseUserIds.admin) even though the schema lists only databaseId + purpose as required.

  • The validation error message misspells the field as databaseUserIDs (capital IDs) while the accepted field is databaseUserIds:

    "message": "database user 'admin' required",
    "path": "databaseUserIDs",
    "context": { "missingProperty": "databaseUserIDs.admin" }
    

Request

  • Add mw app database link | unlink | replace (or equivalent under mw database) mirroring the API above.
  • Independently: fix the validation error casing (databaseUserIDsdatabaseUserIds) so the message matches the accepted payload.

Context

Surfaced while building and validating the mittwald-migrate skill. Filing upstream (API-supported but CLI-missing) rather than baking a curl workaround into the skill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions