From 29ce87d39fab6013f6711906aa23d07056bc996f Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 20 Dec 2015 02:09:39 +0300 Subject: [PATCH] Extend db structure for Book; add Genre --- m_librarian/db.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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): -- 2.39.2