solmoller / eversolar-monitor

Script to capture data and create statistics from Eversolar/zeversolar Solar Inverters. Includes easy install image files for Raspberry Pi. Working edition since 2012 :-)
https://github.com/solmoller/eversolar-monitor/blob/wiki/Introduction.md
MIT License
30 stars 20 forks source link

Update old database version, or print 2 fail messages #36

Closed sorentorp closed 5 years ago

sorentorp commented 5 years ago

Any ideas on how to get around this issue?

Update old database version, or print 2 fail messages : DBD::SQLite::db do failed: duplicate column name: vpv2 at eversolar.pl line 708. DBD::SQLite::db do failed: duplicate column name: ipv2 at eversolar.pl line 709. Done updating old database version.

wotid commented 5 years ago

You're stretching my memory, but I think I solved that myself by commenting out a couple of lines after

"## START OF PROGRAM"

"## Setup database"

Mine looks like this:

"# vpv2 and ipv2 were added in later versions - fix any existing databases that don't have the columns" "# print "Update old database version, or print 2 fail messages : \n";" "# $dbh->do("ALTER TABLE inverter ADD COLUMN vpv2 FLOAT") or 1;" "# $dbh->do("ALTER TABLE inverter ADD COLUMN ipv2 FLOAT") or 1;" "# print "Done updating old database version. \n";"

Regards,

Steve.

(edited: I added " so the hashes didn't affect the p\formatting of the post).

solmoller commented 5 years ago

Is it an issue?

Update old database version, or print 2 fail messages : DBD::SQLite::db do failed: duplicate column name: vpv2 at eversolar.pl line 708. DBD::SQLite::db do failed: duplicate column name: ipv2 at eversolar.pl line 709. Done updating old database version.

The old database is updated first time around, thereafter you get the two messages. I tried getting the code to behave nicely, but didn't figure it was worth the hasstle

sorentorp commented 5 years ago

Ah okay. Thank you!