grafana / grafana-plugin-examples

189 stars 53 forks source link

Example: Add frontend migration example #335

Open andresmgot opened 4 months ago

andresmgot commented 4 months ago

Example of how a change in the API + migration code may look in a plugin.

Note that this assumes that the plugin uses a schema and a API version. See this base PR.

In this case, I am deprecating the field multiplier of the QueryData and renamed it multiply. Now both properties are optional, to avoid breaking changes in the apiVersion.

Note that the query is automatically migrated when running a query but it's necessary for the plugin to manually call migrateQuery in the QueryEditor to ensure that it's using the latest version of the Query schema.

This is a demonstration for https://github.com/grafana/grafana/pull/90231