grafana/pkg/cmd/grafana-cli
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
..
commands Grafana CLI: add admin db-migrate subcommand (#125182) 2026-05-21 09:49:55 +02:00
logger Fix: Prints should always include new lines (#102795) 2025-03-27 12:27:53 +01:00
models
runner Chore: Deprecate legacy encryption package for MT apps (#124337) 2026-05-07 09:38:09 +02:00
services Plugins: Move discovery logic to plugin sources (#106911) 2025-06-19 10:28:23 +01:00
utils Auth: Use dedicated token for requests to Grafana.com (#122269) 2026-05-05 09:55:22 -04:00