Grafana not starting after upgrading from 6.0.2 to 6.1.3 : trying to insert a non existing column

Hi,

after updating grafana from 6.0.2 to 6.1.3 with yum, I get the following errors :

t=2019-04-10T16:33:25+0200 lvl=eror msg=“Executing migration failed” logger=migrator id=“copy data_source v1 to v2” error=“pq: column “account_id” does not exist”
t=2019-04-10T16:33:25+0200 lvl=eror msg=“Exec failed” logger=migrator error=“pq: column “account_id” does not exist” sql="INSERT INTO “user” (“id”\n, “version”\n, “login”\n, “name”\n, “org_id”\n, “is_admin”\n, “created”\n, “email”\n, “password”\n, “salt”\n, “rands”\n, “company”\n, “updated”) SELECT “id”\n, “version”\n, “login”\n, “name”\n, “account_id”\n, “is_admin”\n, “created”\n, “email”\n, “password”\n, “salt”\n, “rands”\n, “company”\n, “updated” FROM “user_v1"”
t=2019-04-10T16:33:25+0200 lvl=eror msg=“Server shutdown” logger=server reason=“Service init failed: Migration failed err: pq: column “account_id” does not exist”

t=2019-04-10T16:33:25+0200 lvl=info msg=“Executing migration” logger=migrator id=“Rename table user to user_v1 - v1”
t=2019-04-10T16:33:25+0200 lvl=eror msg=“Executing migration failed” logger=migrator id=“Rename table user to user_v1 - v1” error=“pq: relation “user_v1” already exists”
t=2019-04-10T16:33:25+0200 lvl=eror msg=“Exec failed” logger=migrator error=“pq: relation “user_v1” already exists” sql="ALTER TABLE “user” RENAME TO “user_v1"”
t=2019-04-10T16:33:25+0200 lvl=eror msg=“Server shutdown” logger=server reason=“Service init failed: Migration failed err: pq: relation “user_v1” already exists”

I tried to rename user_v1 table before starting but it is not better. (maybe due to first error with account_id in user_v1 which is not existing … I think it should be org_id instead of account_id)

Could you help me : GAFANA is not starting any more.

some more infos : PostgreSQL 9.4.10 / CentOS Linux release 7.5.1804
same issue with applying grafana-6.1.4-1.x86_64.rpm on my upgraded version (6.0.2->6.1.3->6.1.4)

Regards

I have the exact same problem.

I’ve tried with a fresh setup with 6.1.3 -> works perfectly.
Migration on 6.1.4 fail again with same issue.

No problem with mysql backend. Seems located on postgres side only

For me the problem started after 6.0.2. Fresh setup on 6.0.2 worked fine, then updating to 6.1.0 fails with same error as philgraf is reporting. I am also using postgres

devel trunk (grafana-6.2.0-4888dabepre) is broken too.
If I look into migration_log my last value is about add unique indexuser_auth_token.prev_auth_token

log:

INFO[04-16|22:55:20] Connecting to DB logger=sqlstore dbtype=postgres
INFO[04-16|22:55:20] Starting DB migration logger=migrator
INFO[04-16|22:55:20] Executing migration logger=migrator id=“create migration_log table”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“create user table”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“add unique index user.login”
WARN[04-16|22:55:20] Skipping migration: Already executed, but not recorded in migration log logger=migrator id=“add unique index user.login”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“add unique index user.email”
WARN[04-16|22:55:20] Skipping migration: Already executed, but not recorded in migration log logger=migrator id=“add unique index user.email”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“drop index UQE_user_login - v1”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“drop index UQE_user_email - v1”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“Rename table user to user_v1 - v1”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“create user table v2”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“create index UQE_user_login - v2”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“create index UQE_user_email - v2”
INFO[04-16|22:55:20] Executing migration logger=migrator id=“copy data_source v1 to v2”
EROR[04-16|22:55:20] Executing migration failed logger=migrator id=“copy data_source v1 to v2” error=“pq: column "account_id" does not exist”
EROR[04-16|22:55:20] Exec failed logger=migrator error=“pq: column "account_id" does not exist” sql=“INSERT INTO "user" ("company"\n, "org_id"\n, "is_admin"\n, "created"\n, "updated"\n, "id"\n, "version"\n, "rands"\n, "password"\n, "salt"\n, "login"\n, "email"\n, "name") SELECT "company"\n, "account_id"\n, "is_admin"\n, "created"\n, "updated"\n, "id"\n, "version"\n, "rands"\n, "password"\n, "salt"\n, "login"\n, "email"\n, "name" FROM "user_v1"”
EROR[04-16|22:55:20] Server shutdown logger=server reason=“Service init failed: Migration failed err: pq: column "account_id" does not exist”

The last ID of migration_log table is 211, on 6.1.4 222. Still digging where the bug is

I tested with grafana 6.3.3 : the upgrade works fine now.