curtwagner1984 / YAPO

Yapo - Yet Another Porn Organizer
GNU General Public License v3.0
49 stars 10 forks source link

DB Columns aren't auto created (Ubuntu) #55

Open chimerasoup opened 6 years ago

chimerasoup commented 6 years ago

After installing YAPO and starting the web server, there are a number of columns that aren't created automatically for some reason. Some of these columns are:

videos_localscenefolders.date_added
videos_scene.date_last_played
videos_scene.modified_date
videos_scene.last_filename_tag_lookup
videos_folder.date_added
videos_folder.modified_date
videos_actor.modified_date
videos_actoralias.date_added
videos_website.website_alias
videos_website.modified_date
videos_scenetag.scene_tag_alias
videos_scenetag.modified_date
videos_actortag.actor_tag_alias

and the table videos_actortag_scene_tags

The lack of these columns caused many things not to work (e.g. Adding a Folder, creating a Tag, etc.). After created the columns manually in the DB, many errors disappeared. I haven't tested everything yet.

Error Example: After installing and running YAPO, when I click on Settings, YAPO complains that videos_localscenefolders.date_added doesn't exist.

Server Console output:

username@servername:~/YAPO$ python3 manage.py runserver 0.0.0.0:8000
Static files dir is: /home/username/YAPO/videos/static
Media files dir is: /home/username/YAPO/videos/media
Static files dir is: /home/username/YAPO/videos/static
Media files dir is: /home/username/YAPO/videos/media
Performing system checks...

/usr/bin/vlc
System check identified some issues:

WARNINGS:
videos.Actor.actor_aliases: (fields.W340) null has no effect on ManyToManyField.
videos.Actor.actor_tags: (fields.W340) null has no effect on ManyToManyField.
videos.ActorTag.scene_tags: (fields.W340) null has no effect on ManyToManyField.
videos.Folder.scenes: (fields.W340) null has no effect on ManyToManyField.
videos.Playlist.scenes: (fields.W340) null has no effect on ManyToManyField.
videos.Scene.actors: (fields.W340) null has no effect on ManyToManyField.
videos.Scene.scene_tags: (fields.W340) null has no effect on ManyToManyField.
videos.Scene.websites: (fields.W340) null has no effect on ManyToManyField.
videos.Website.scene_tags: (fields.W340) null has no effect on ManyToManyField.

System check identified 9 issues (0 silenced).
November 18, 2017 - 17:41:14
Django version 1.9.6, using settings 'YAPO.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
get method works!
/usr/bin/vlc
{"settings_version": 3, "vlc_path": "/usr/bin/vlc", "last_all_scene_tag": ""}
[18/Nov/2017 17:41:28] "GET /settings/?pathToVlc= HTTP/1.1" 200 72
Internal Server Error: /api/folder-local/
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/sqlite3/base.py", line 323, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: videos_localscenefolders.date_added

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/rest_framework/viewsets.py", line 87, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.6/dist-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/rest_framework/mixins.py", line 42, in list
    page = self.paginate_queryset(queryset)
  File "/usr/local/lib/python3.6/dist-packages/rest_framework/generics.py", line 172, in paginate_queryset
    return self.paginator.paginate_queryset(queryset, self.request, view=self)
  File "/usr/local/lib/python3.6/dist-packages/rest_framework/pagination.py", line 315, in paginate_queryset
    return list(queryset[self.offset:self.offset + self.limit])
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 258, in __iter__
    self._fetch_all()
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 1074, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 52, in __iter__
    results = compiler.execute_sql()
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.6/dist-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/sqlite3/base.py", line 323, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: videos_localscenefolders.date_added
[18/Nov/2017 17:41:28] "GET /api/folder-local/ HTTP/1.1" 500 139562
humble-b commented 6 years ago

This also counts for Windows installation. Did fresh install of YAPO and the same errors occured

humble-b commented 6 years ago

after install sqlite3 and add this to the windows path i solved this the following way:

go to the YAPO installation folder: e.g. c:\projects\YAPO enter: manage.py dbshell

In the sqlite shell enter the following:

ALTER TABLE "videos_localscenefolders" ADD COLUMN "date_added" datetime;
ALTER TABLE "videos_scene" ADD COLUMN "date_last_played" datetime;
ALTER TABLE "videos_scene" ADD COLUMN "modified_date" datetime;
ALTER TABLE "videos_scene" ADD COLUMN "last_filename_tag_lookup" varchar(500) NULL;
ALTER TABLE "videos_folder" ADD COLUMN "date_added" datetime;
ALTER TABLE "videos_folder" ADD COLUMN "modified_date" datetime;
ALTER TABLE "videos_actor" ADD COLUMN "modified_date" datetime;
ALTER TABLE "videos_actoralias" ADD COLUMN "date_added" datetime;
ALTER TABLE "videos_website" ADD COLUMN "website_alias" varchar(500) NULL;
ALTER TABLE "videos_website" ADD COLUMN "modified_date" datetime;
ALTER TABLE "videos_scenetag" ADD COLUMN "scene_tag_alias" varchar(500) NULL;
ALTER TABLE "videos_scenetag" ADD COLUMN "modified_date" datetime;
ALTER TABLE "videos_actortag" ADD COLUMN "actor_tag_alias" varchar(500) NULL;
ALTER TABLE "videos_actortag" ADD COLUMN "modified_date" datetime;

CREATE TABLE IF NOT EXISTS "videos_playlist" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "name" varchar(500) NOT NULL, "date_added" datetime NOT NULL, "modified_date" datetime  NOT NULL);
CREATE TABLE IF NOT EXISTS "videos_actortag_scene_tags" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "name" varchar(500) NOT NULL, "date_added" datetime NOT NULL, "modified_date" datetime  NOT NULL);

.quit

laatste commando is om de sql prompt af te sluiten