pymedusa / Medusa

Automatic Video Library Manager for TV Shows. It watches for new episodes of your favorite shows, and when they are posted it does its magic.
https://pymedusa.com
GNU General Public License v3.0
1.8k stars 276 forks source link

DB error: table history has no column named proper_tags #1140

Closed sebastientinel closed 8 years ago

sebastientinel commented 8 years ago

Branch/Commit: Branch: masster / Commit 04137b68fcd93e5a22423e394bba00f199620591 Version: v0.1.5 OS: Linux-4.4.6-std-2-x86_64-with-centos-7.2.1511-Core What you did: Update to commit 04137b68fcd93e5a22423e394bba00f199620591 What happened: Did not update the database structure What you expected: An error free updated version

Logs:

2016-09-18 15:29:05 ERROR    SEARCHQUEUE-BACKLOG-302205 :: [04137b6] DB error: table history has no column named proper_tags
Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/db.py", line 265, in action
    sql_results = self._execute(query, args, fetchall=fetchall, fetchone=fetchone)
  File "/usr/pymedusa/sickbeard/db.py", line 108, in _execute
    sql_results = self.connection.cursor().execute(query, args)
OperationalError: table history has no column named proper_tags
2016-09-18 15:29:05 ERROR    SEARCHQUEUE-BACKLOG-302205 :: [04137b6] DB error: OperationalError('table history has no column named proper_tags',)
Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/db.py", line 108, in _execute
    sql_results = self.connection.cursor().execute(query, args)
OperationalError: table history has no column named proper_tags
2016-09-18 15:14:17 ERROR    Thread-15 :: [04137b6] DB error: OperationalError('no such column: h.proper_tags',)
Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/db.py", line 106, in _execute
    sql_results = self.connection.cursor().execute(query)
OperationalError: no such column: h.proper_tags
2016-09-18 15:14:17 ERROR    Thread-15 :: [04137b6] DB error: no such column: h.proper_tags
Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/db.py", line 265, in action
    sql_results = self._execute(query, args, fetchall=fetchall, fetchone=fetchone)
  File "/usr/pymedusa/sickbeard/db.py", line 106, in _execute
    sql_results = self.connection.cursor().execute(query)
OperationalError: no such column: h.proper_tags
2016-09-18 15:14:17 ERROR    Thread-15 :: [04137b6] Failed doing web ui callback: Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/server/web/core/base.py", line 269, in async_call
    result = function(**kwargs)
  File "/usr/pymedusa/sickbeard/server/web/core/history.py", line 34, in index
    history = self.history.get(limit)
  File "/usr/pymedusa/sickrage/show/History.py", line 71, in get
    sql_results = self.db.select(common_sql + order_sql)
  File "/usr/pymedusa/sickbeard/db.py", line 295, in select
    sql_results = self.action(query, args, fetchall=True)
  File "/usr/pymedusa/sickbeard/db.py", line 265, in action
    sql_results = self._execute(query, args, fetchall=fetchall, fetchone=fetchone)
  File "/usr/pymedusa/sickbeard/db.py", line 106, in _execute
    sql_results = self.connection.cursor().execute(query)
OperationalError: no such column: h.proper_tags
Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/server/web/core/base.py", line 269, in async_call
    result = function(**kwargs)
  File "/usr/pymedusa/sickbeard/server/web/core/history.py", line 34, in index
    history = self.history.get(limit)
  File "/usr/pymedusa/sickrage/show/History.py", line 71, in get
    sql_results = self.db.select(common_sql + order_sql)
  File "/usr/pymedusa/sickbeard/db.py", line 295, in select
    sql_results = self.action(query, args, fetchall=True)
  File "/usr/pymedusa/sickbeard/db.py", line 265, in action
    sql_results = self._execute(query, args, fetchall=fetchall, fetchone=fetchone)
  File "/usr/pymedusa/sickbeard/db.py", line 106, in _execute
    sql_results = self.connection.cursor().execute(query)
OperationalError: no such column: h.proper_tags
2016-09-18 15:14:17 DEBUG    TORNADO :: [04137b6] Failed doing web ui request u'index': Traceback (most recent call last):
  File "/usr/pymedusa/sickbeard/server/web/core/base.py", line 253, in get
    results = yield self.async_call(method)
  File "/usr/pymedusa/lib/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/usr/pymedusa/lib/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "/usr/pymedusa/lib/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/pymedusa/sickbeard/server/web/core/base.py", line 269, in async_call
    result = function(**kwargs)
  File "/usr/pymedusa/sickbeard/server/web/core/history.py", line 34, in index
    history = self.history.get(limit)
  File "/usr/pymedusa/sickrage/show/History.py", line 71, in get
    sql_results = self.db.select(common_sql + order_sql)
  File "/usr/pymedusa/sickbeard/db.py", line 295, in select
    sql_results = self.action(query, args, fetchall=True)
  File "/usr/pymedusa/sickbeard/db.py", line 265, in action
    sql_results = self._execute(query, args, fetchall=fetchall, fetchone=fetchone)
  File "/usr/pymedusa/sickbeard/db.py", line 106, in _execute
    sql_results = self.connection.cursor().execute(query)
OperationalError: no such column: h.proper_tags
fernandog commented 8 years ago

@sebastientinel did you git pull or updated from UI? After update from UI, did Medusa restarted?

Did your database come from SickRage originally?

sebastientinel commented 8 years ago

@fernandog Thanks for your quick answer.

I updated from the UI and it seems (had to hit the homepage button) to have restarted properly. Indeed my database comes from SickRage, I migrate to medusa since several weeks.

fernandog commented 8 years ago

problem is SickRage db MAY be different from outs. We will check what to do and report soon

medariox commented 8 years ago

@sebastientinel We just released version 0.1.5.1 - please update and let us know how it goes, thanks a lot for the bug report.

sebastientinel commented 8 years ago

@medariox Thanks A LOT, it works flawlessly !!

Just for information, I found out a difference of structure table "tv_shows" between my database and a fresh one. Mine has the additional column "sub_use_sr_metadata" which is not used in Medusa.

The following SQLITE commands should do the trick :

CREATE TEMPORARY TABLE tvs_backup(show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer NUMERIC, show_name TEXT, location TEXT, network TEXT, genre TEXT, classification TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, air_by_date NUMERIC, lang TEXT, subtitles NUMERIC, notify_list TEXT, imdb_id TEXT, last_update_indexer NUMERIC, dvdorder NUMERIC, archive_firstmatch NUMERIC, rls_require_words TEXT, rls_ignore_words TEXT, sports NUMERIC, anime NUMERIC, scene NUMERIC, default_ep_status NUMERIC DEFAULT -1);

CREATE UNIQUE INDEX idx_indexer_id ON tvs_backup(indexer_id);

INSERT INTO tvs_backup SELECT show_id, indexer_id, indexer, show_name, location, network, genre, classification, runtime, quality, airs, status, flatten_folders, paused, startyear, air_by_date, lang, subtitles, notify_list, imdb_id, last_update_indexer, dvdorder, archive_firstmatch, rls_require_words, rls_ignore_words, sports, anime, scene, default_ep_status FROM tv_shows;

DROP TABLE tv_shows;

CREATE TABLE tv_shows(show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer NUMERIC, show_name TEXT, location TEXT, network TEXT, genre TEXT, classification TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, air_by_date NUMERIC, lang TEXT, subtitles NUMERIC, notify_list TEXT, imdb_id TEXT, last_update_indexer NUMERIC, dvdorder NUMERIC, archive_firstmatch NUMERIC, rls_require_words TEXT, rls_ignore_words TEXT, sports NUMERIC, anime NUMERIC, scene NUMERIC, default_ep_status NUMERIC DEFAULT -1);

CREATE UNIQUE INDEX idx_indexer_id ON tv_shows(indexer_id);

INSERT INTO tv_shows SELECT show_id, indexer_id, indexer, show_name, location, network, genre, classification, runtime, quality, airs, status, flatten_folders, paused, startyear, air_by_date, lang, subtitles, notify_list, imdb_id, last_update_indexer, dvdorder, archive_firstmatch, rls_require_words, rls_ignore_words, sports, anime, scene, default_ep_status FROM tvs_backup;

DROP TABLE tvs_backup;

Is it safe to update the structure directly ?

Thanks again for your great work !

medariox commented 8 years ago

You're welcome! Yes, we are aware of the difference between the two databases. We chose not to remove superfluous columns for now, but to address them at a later stage. Of course, you can just remove them yourself if you wish to (I don't see anything wrong with what you did above), but it's not needed to make Medusa work correctly.

sebastientinel commented 8 years ago

Thanks, I'll stay mainstream so.