Hi @eapperley
Well this is certainly not a good outcome. It looks like this was occuring for others last year, after the update from 6 to 7. I’d check out this comment:
Instead of deleting the whole grafana.db file, you can also open it with a tool like https://sqlitebrowser.org/ . There, you can delete just the one UNIQUE constraint (on table data_source), then save the db file and restart Grafana. This worked for me (I also downgraded from Grafana 7 to 6.7.4 before the error occurred first).
Also check out this comment:
opened 12:33PM - 26 Sep 20 UTC
closed 12:29AM - 07 Oct 20 UTC
**What happened:** After the downgrade of grafana from 7.1.3 to 6.6.2 not able t… o add any datasource.
**What you expected to happen:** Even after downgrade we should be able to add datasource.
**How to reproduce it (as minimally and precisely as possible):**
1. Install grafana 6.6.2 using helm chart
2. Upgrade grafana to 7.1.3 version
3. later rollback from 7.1.3 to 6.6.2
4. Try to add datasource.
After downgrade datasource addition is failing with the below error.
lvl=eror msg="Failed to add datasource" logger=context userId=1 orgId=1 uname=admin error="UNIQUE constraint failed: data_source.org_id, data_source.uid"
**Anything else we need to know?:**
**Environment:**
Grafana version: 7.1.3
Data source type & version:
OS Grafana is installed on:
User OS & Browser: n/a
Grafana plugins:
Others: n/a
Once you’ve fixed this issue, I’d suggest making a backup of your db and then considering an upgrade. Grafana 8 shipped last month and it is considerably more feature rich than 6, as is 7.5.7.
Hope this helps!