wbh1 / grafana-sqlite-to-postgres

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

Create new release? #48

Closed navinpai closed 1 year ago

navinpai commented 1 year ago

Tried to use the latest release of this project to migrate Grafana 9.x from sqlite to postgres. Got the following error:

time="2023-09-05T14:07:51Z" level=info msg="πŸ“ SQLlite file: /var/lib/grafana/grafana.db"
time="2023-09-05T14:07:51Z" level=info msg="πŸ“ Dump directory: /tmp"
time="2023-09-05T14:07:51Z" level=info msg="βœ… sqlite3 command exists"
time="2023-09-05T14:07:52Z" level=info msg="βœ… sqlite3 database dumped to /tmp/grafana.sql"
time="2023-09-05T14:07:53Z" level=info msg="βœ… CREATE statements removed from dump file"
time="2023-09-05T14:07:57Z" level=info msg="βœ… sqlite3 dump sanitized"
time="2023-09-05T14:07:58Z" level=info msg="βœ… migration_log statements removed"
time="2023-09-05T14:07:58Z" level=info msg="βœ… char keyword transformed"
time="2023-09-05T14:07:58Z" level=info msg="βœ… hex-encoded data values wrapped for insertion"
time="2023-09-05T14:08:08Z" level=fatal msg="❌ pq: column \"is_paused\" is of type boolean but expression is of type integer INSERT INTO \"alert_rule\" VALUES(1,1,'Alert-testing','C','[{\"refId\":\"A\",\"queryType\":\"\",\"relativeTimeRange\":{\"from\":900,\"to\":0},\"datasourceUid\":\"metrics\",\"model\":{\"editorMode\":\"builder\",\"expr\":\"container_cpu_usage_seconds_total\",\"hide\":false,\"intervalMs\":1000,\"legendFormat\":\"__auto\",\"maxDataPoints\":43200,\"range\":true,\"refId\":\"A\"}},{\"refId\":\"B\",\"queryType\":\"\",\"relativeTimeRange\":{\"from\":900,\"to\":0},\"datasourceUid\":\"__expr__\",\"model\":{\"conditions\":[{\"evaluator\":{\"params\":[],\"type\":\"gt\"},\"operator\":{\"type\":\"and\"},\"query\":{\"params\":[\"B\"]},\"reducer\":{\"params\":[],\"type\":\"last\"},\"type\":\"query\"}],\"datasource\":{\"type\":\"__expr__\",\"uid\":\"__expr__\"},\"expression\":\"A\",\"hide\":false,\"intervalMs\":1000,\"maxDataPoints\":43200,\"reducer\":\"last\",\"refId\":\"B\",\"type\":\"reduce\"}},{\"refId\":\"C\",\"queryType\":\"\",\"relativeTimeRange\":{\"from\":900,\"to\":0},\"datasourceUid\":\"__expr__\",\"model\":{\"conditions\":[{\"evaluator\":{\"params\":[1],\"type\":\"gt\"},\"operator\":{\"type\":\"and\"},\"query\":{\"params\":[\"C\"]},\"reducer\":{\"params\":[],\"type\":\"last\"},\"type\":\"query\"}],\"datasource\":{\"type\":\"__expr__\",\"uid\":\"__expr__\"},\"expression\":\"B\",\"hide\":false,\"intervalMs\":1000,\"maxDataPoints\":43200,\"refId\":\"C\",\"type\":\"threshold\"}}]','2023-09-05 11:18:29',60,2,'2QvWDLkSk','K3O-lFkIz','devops','NoData','Error',300000000000,'{}','{}',NULL,NULL,1,0) - failed to import dump file to Postgres."

Looks like this is caused because of the field is_paused in the table alert_rule not satisfying the SQLite constraint of boolean<>integer.

But I noticed that these columns were handled as part of this commit. However, looks like there's been no release created with this change.

Could you please create a new release (It's anyway been 10 months since the last release)? Thanks

wbh1 commented 1 year ago

New release is available here: https://github.com/wbh1/grafana-sqlite-to-postgres/releases/tag/v2.2.4.