Hi there,
We’re trying to upgrade Grafana from version 8.2.7 to 8.*. Our Grafana instance is running in AWS ECS as a fargate task and it is connected to a Postgres database for persistance data. Normally we change the dockerfile version so that it builds a newer docker with the specified version but as soon as the docker is spinning up we’re getting the following error:
“Starting DB migrations logger =migrator”
“Executing migration logger =migrator= Add is_service_account column to user”
“Exec failed logger =migrator= pq: must be owner of table user”
The error seems clear enough but we cannot figure out under which account it is trying to update the table. The actual user account which is configured in the grafana.ini has admin permissions and was able to do all the migrations before with success. Has anyone else run into this exact problem? If so, what was your fix?
Kind regards,
Rick van Wijk
Hello and welcome to the forum, @rickvwijk
I think you should research this related GitHub issue and maybe add to that thread? If relevant?
opened 06:33PM - 29 Jul 21 UTC
type/bug
prio/low
effort/medium
needs investigation
area/alerting/unified
area/backend/db/migration
<!--
Please use this template to create your bug report. By providing as much i… nfo as possible you help us understand the issue, reproduce it and resolve it for you quicker. Therefor take a couple of extra minutes to make sure you have provided all info needed.
PROTIP: record your screen and attach it as a gif to showcase the issue.
- Questions should be posted to: https://localhost:3000
- Use query inspector to troubleshoot issues: https://bit.ly/2XNF6YS
- How to record and attach gif: https://bit.ly/2Mi8T6K
-->
**What happened**:
*"Executing migration failed"*
**What you expected to happen**:
Migration success.
**How to reproduce it (as minimally and precisely as possible)**:
1. take the v7.4.3 database PostgreSQL dump
2. restore one on a staging environment
3. deploy and start grafana-7.5.10 that execute its migration successfully
4. so, deploy and start grafana-8.0.6 that breaks message "Executing migration failed" with
**Anything else we need to know?**:
**Environment**:
- Grafana version: 7.4.3 -> 7.5.10 -> 8.0.6
- Data source type & version: NA
- OS Grafana is installed on: docker/kubernetes
- User OS & Browser: NA
- Grafana plugins: (bellow list)
<details>
```
agenty-flowcharting-panel, alexanderzobnin-zabbix-app, bessler-pictureit-panel, briangann-datatable-panel,
briangann-gauge-panel, btplc-peak-report-panel, btplc-status-dot-panel, btplc-trend-box-panel,
digiapulssi-breadcrumb-panel, digiapulssi-organisations-panel, digrich-bubblechart-panel,
fatcloud-windrose-panel, grafana-clock-panel, grafana-kubernetes-app, grafana-piechart-panel,
grafana-polystat-panel, grafana-worldmap-panel, gretamosa-topology-panel, jdbranham-diagram-panel,
larona-epict-panel, marcuscalidus-svg-panel, marcusolsson-csv-datasource, michaeldmoore-annunciator-panel,
michaeldmoore-multistat-panel, mtanda-histogram-panel, natel-discrete-panel, natel-plotly-panel,
neocat-cal-heatmap-panel, pierosavi-imageit-panel, satellogic-3d-globe-panel, savantly-heatmap-panel,
scadavis-synoptic-panel, snuids-radar-panel, snuids-trafficlights-panel, vonage-status-panel
```
</details>
- Others: (logging)
<details>
```
lvl=info msg="Connecting to DB" logger=sqlstore dbtype=postgres
lvl=info msg="Starting DB migrations" logger=migrator
lvl=info msg="Executing migration" logger=migrator id="add index in alert_instance table on def_org_id, def_uid and current_state columns"
lvl=eror msg="Executing migration failed" logger=migrator id="add index in alert_instance table on def_org_id, def_uid and current_state columns" error="pq: coluna \"def_org_id\" não existe"
lvl=eror msg="Exec failed" logger=migrator error="pq: coluna \"def_org_id\" não existe" sql="CREATE INDEX \"IDX_alert_instance_def_org_id_def_uid_current_state\" ON \"alert_instance\" (\"def_org_id\",\"def_uid\",\"current_state\");"
service init failed: migration failed (id = add index in alert_instance table on def_org_id, def_uid and current_state columns): pq: transaction stopped ...
```
</details>