grafana/pkg/cmd
Rafael Bortolon Paulovic b590b482cb
Grafana CLI: add admin db-migrate subcommand (#125182)
* Grafana CLI: add admin db-migrate subcommand

Wraps server.InitializeForCLI through runDbCommand so a paused tenant's
schema can be advanced without booting the full Grafana process. The
runner init drives the migration as a side effect; logLastMigration then
reports the most recent migration_log row.

Enterprise builds (e.g. hosted-grafana-pro) automatically pick up
*EnterpriseMigrations via the existing wireexts overlay — verified
empirically on grafana-pro 13.1.0: a single `cli admin db-migrate`
invocation applies all 863 OSS + enterprise migrations, with no second
`grafana server` boot needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Grafana CLI: use dialect-aware boolean in migration_log query

Pass `dialect.BooleanValue(true)` instead of a literal `true` so the
comparison binds correctly on every dialect (MySQL/SQLite store success
as 0/1, Postgres as native bool).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 09:49:55 +02:00
..
grafana Provisioning: Fix import cycle between grafana and provisioning app (#110406) 2025-09-01 13:29:34 +00:00
grafana-cli Grafana CLI: add admin db-migrate subcommand (#125182) 2026-05-21 09:49:55 +02:00
grafana-server/commands Auth: Use dedicated token for requests to Grafana.com (#122269) 2026-05-05 09:55:22 -04:00