I enabled it again and created all missing folders in the repo with an empty file name .keep
Then I changed the namespace_uid in table alert_rule to the new guid in the resource table
Everything is back now
Also, I have asked GitHub Copilot on the grafana/grafana repo about the folder dashboards , folders , and resources Here is the answer
Purpose of the “resource” Table
The resource table in Grafana’s PostgreSQL database is a generalized storage layer for various types of resources, not just dashboards. It is part of Grafana’s “unified storage” system, which is designed to support storing different objects (like dashboards, library panels, folders, etc.) with rich metadata, versioning, and labels—similar to how Kubernetes resources are managed.
Key points from the migration code:
Columns include: guid (primary key), resource_version, group, resource, namespace, name, value, action (create/update/delete), and label_set.
The table is generic: the combination of group, resource, namespace, and name forms a unique identity for each resource, allowing for polymorphic storage.
The value column stores the actual data (often as a serialized blob or text).
See resource_mig.go for the migration definition.Purpose of the “dashboard” Table
The dashboard table is the original, dedicated table specifically for storing dashboard entities. It is tailored for dashboard-specific fields such as title, JSON model, creation metadata, etc. This is the “legacy” storage: older APIs and much of Grafana’s UI still use this table directly.
SQL examples (see docs and code):
You can run SQL queries directly on the dashboard table to get dashboard metadata, join with users, etc.
The table contains columns specific to dashboards.
Difference Between “resource” and “dashboard”
resource table:
Stores multiple types of resources, not just dashboards.
Uses polymorphic keys (group, resource, namespace, name) for identification.
Supports versioning, labels, and generic metadata.
Used by new APIs, provisioning, and advanced management (such as trash/history, k8s-style management, etc.).
Dashboards stored here may have richer metadata, be managed as resources, and are compatible with newer features.
dashboard table:
Stores only dashboards.
Traditional structure: columns like id, title, data, created_by, etc.
Used by legacy code paths and some UI features.
Why Do Both Tables Exist?
Grafana is migrating toward a unified resource model:
The resource table provides a future-proof, extensible way to store many object types.
The dashboard table remains for backward compatibility and performance with older features.
The dashboard information in the resource table is a representation of dashboards as “resources” (with versioning, labels, etc.), while the dashboard table is the legacy, dedicated dashboard storage.