From: Oleg Broytman Date: Thu, 11 Feb 2016 21:34:46 +0000 (+0300) Subject: Split name column into 3 X-Git-Tag: 0.0.4~54 X-Git-Url: https://git.phdru.name/?p=m_librarian.git;a=commitdiff_plain;h=e024316d57d1b879bdedcc3c80d6583fd86a7b3c Split name column into 3 Most authors in the INP files have at least a surname, often a name, sometimes a middle name or a patronymic. --- diff --git a/m_librarian/db.py b/m_librarian/db.py index 395d667..6e08204 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -53,11 +53,14 @@ if connection.dbName == 'sqlite': class Author(SQLObject): - name = UnicodeCol(notNull=True, unique=True) + surname = UnicodeCol(notNull=True) + name = UnicodeCol(notNull=True) + misc_name = UnicodeCol(notNull=True) count = IntCol(notNull=True) books = RelatedJoin('Book', otherColumn='book_id', intermediateTable='author_book', createRelatedTable=False) + full_name_idx = DatabaseIndex(surname, name, misc_name, unique=True) count_idx = DatabaseIndex(count)