From: Oleg Broytman Date: Sat, 19 Dec 2015 23:09:39 +0000 (+0300) Subject: Extend db structure for Book; add Genre X-Git-Tag: 0.0.1~1 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=29ce87d39fab6013f6711906aa23d07056bc996f;p=m_librarian.git Extend db structure for Book; add Genre --- diff --git a/m_librarian/db.py b/m_librarian/db.py index e78f8f1..225e2ec 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -1,8 +1,8 @@ #! /usr/bin/env python import os -from sqlobject import SQLObject, StringCol, UnicodeCol, IntCol, \ - connectionForURI, sqlhub +from sqlobject import SQLObject, StringCol, UnicodeCol, IntCol, BoolCol, \ + ForeignKey, DateCol, connectionForURI, sqlhub from .config import ml_conf try: @@ -42,8 +42,25 @@ class Author(SQLObject): count = IntCol() +class Genre(SQLObject): + name = StringCol() + title = UnicodeCol() + count = IntCol() + + class Book(SQLObject): - name = UnicodeCol() + author = ForeignKey('Author') + genre = ForeignKey('Genre') + title = UnicodeCol() + series = UnicodeCol() + ser_no = IntCol() + file = StringCol() + size = IntCol() + lib_id = StringCol() + deleted = BoolCol() + ext = ForeignKey('Extension') + date = DateCol() + language = ForeignKey('Language') class Extension(SQLObject):