radiocicletta / morganfreeman

A simple analytics for icecast servers
15 stars 5 forks source link

Db initialization fails on new installations #3

Closed hectorviov closed 9 years ago

hectorviov commented 9 years ago

I'm having trouble starting the daemon because an exception of a duplicate column with error:

Exception in thread Thread-1:
Traceback (most recent call last):
 File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
   self.run()
 File "/home/ubuntu/morganfreeman/icestats/daemon.py", line 201, in run
   timedupdate()
 File "/home/ubuntu/morganfreeman/icestats/daemon.py", line 165, in timedupdate
   db = DB(self.db)
 File "/home/ubuntu/morganfreeman/icestats/db.py", line 50, in __init__
   self.db.execute(sql)
OperationalError: duplicate column name: iso_code
leofiore commented 9 years ago

that's weird. How many times have you tried to initalize the database? Or, did you upgraded the code and tried to restart the daemon? The problem could lies in the database migration .

hectorviov commented 9 years ago

I just installed like it says on the Readme. Didn't do anything else. I'm running Ubuntu Server...

Saludos, Hector Villarreal On Jul 10, 2015 4:32 AM, "Leonardo" notifications@github.com wrote:

that's weird. How many times have you tried to initalize the database? Or, did you upgraded the code and tried to restart the daemon? The problem could lies in the database migration https://github.com/radiocicletta/morganfreeman/blob/master/icestats/db.py#L27 .

— Reply to this email directly or view it on GitHub https://github.com/radiocicletta/morganfreeman/issues/3#issuecomment-120319385 .

leofiore commented 9 years ago

So, i understood the problem, that relies only on the database initialization. Since the db model was changed through the releases, we created statements for the migrations not thinking about new installations. if you have the sqlite3 command line application, try edit the database stats.sqlite using the pragma directive:

   $ sqlite3 stats.sqlite
   sqlite> pragma user_version = 1;
   sqlite>^D
   $

then restart the application, all should work correctly.