From b507a03d0fb7d533128be397a3f58449bd1ea482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Egelund-M=C3=BCller?= Date: Mon, 6 May 2024 18:54:31 +0200 Subject: [PATCH] Fix: Migrate "chart" resources to "component" resources (#4835) --- runtime/catalog_cache.go | 6 ++++++ runtime/drivers/sqlite/migrations/0022.sql | 1 + 2 files changed, 7 insertions(+) create mode 100644 runtime/drivers/sqlite/migrations/0022.sql diff --git a/runtime/catalog_cache.go b/runtime/catalog_cache.go index 7335494d9f4..b772faf0dc1 100644 --- a/runtime/catalog_cache.go +++ b/runtime/catalog_cache.go @@ -539,6 +539,12 @@ func resourceFromDriver(r drivers.Resource) *runtimev1.Resource { panic(err) } + // Reset resource name to the appropriate DB column values (enables migrations to change the kind and name.) + res.Meta.Name = &runtimev1.ResourceName{ + Kind: r.Kind, + Name: r.Name, + } + // Reset ephemeral fields. res.Meta.ReconcileStatus = runtimev1.ReconcileStatus_RECONCILE_STATUS_IDLE res.Meta.ReconcileError = "" diff --git a/runtime/drivers/sqlite/migrations/0022.sql b/runtime/drivers/sqlite/migrations/0022.sql new file mode 100644 index 00000000000..9b0402ceeda --- /dev/null +++ b/runtime/drivers/sqlite/migrations/0022.sql @@ -0,0 +1 @@ +UPDATE catalogv2 SET kind = 'rill.runtime.v1.Component' WHERE kind = 'rill.runtime.v1.Chart';