wbh1 / grafana-sqlite-to-postgres

Grafana SQLite to Postgres Database Migrator
MIT License
97 stars 26 forks source link

column "send_reminder" of relation "alert_notification" does not exist #15

Closed agn-7 closed 4 years ago

agn-7 commented 4 years ago

After solving sqlite problem, I encountered by this error:

./grafana-migrate_linux_amd64-569e1d3 grafana.db "postgres://grafana_usr:xxx@172.17.0.1:5432/grafana_db?sslmode=disable"

Out:

INFO[2020-06-16T13:46:34+04:30] 📁 SQLlite file: grafana.db                   
INFO[2020-06-16T13:46:34+04:30] 📁 Dump directory: /tmp                       
INFO[2020-06-16T13:46:34+04:30] ✅ sqlite3 command exists                     
INFO[2020-06-16T13:46:34+04:30] ✅ sqlite3 database dumped to /tmp/grafana.sql 
INFO[2020-06-16T13:46:34+04:30] ✅ CREATE statements removed from dump file   
INFO[2020-06-16T13:46:36+04:30] ✅ sqlite3 dump sanitized                     
INFO[2020-06-16T13:46:37+04:30] ✅ migration_log statements removed           
INFO[2020-06-16T13:46:37+04:30] ✅ hex-encoded data decoded                   
FATAL[2020-06-16T13:46:38+04:30] ❌ pq: column "send_reminder" of relation "alert_notification" does not exist   ALTER TABLE alert_notification ALTER COLUMN send_reminder DROP DEFAULT; - failed to import dump file to Postgres. 
wbh1 commented 4 years ago

Hmmm... what version of Grafana are you running? That database column was added back in 2018 (ref)

agn-7 commented 4 years ago

5.1.3

wbh1 commented 4 years ago

If possible, I would recommend upgrading your Grafana to at least version 6.1.0 (which is listed as the first version compatible in the README). When you upgrade, Grafana will automatically run a bunch of table migrations including the one that will fix the issue that you're having.

After upgrading, you should be able to run the tool with success.

agn-7 commented 4 years ago

Unfortunately, I cannot update the Grafana version due to some policies. However, I found another repository which did the convert from SQLite to Postgres.

Thank you for your time.

wbh1 commented 4 years ago

Glad you were able to get it migrated! Based on your feedback and some others, I'm going to open a separate issue in order to implement warning logging when issues like these pop up since it's much easier than giving version guarantees and haron's migrator just logs the errors and ignores them anyway.