]> git.phdru.name Git - m_librarian.git/commitdiff
Split name column into 3
authorOleg Broytman <phd@phdru.name>
Thu, 11 Feb 2016 21:34:46 +0000 (00:34 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 11 Feb 2016 21:34:46 +0000 (00:34 +0300)
Most authors in the INP files have at least a surname, often a name,
sometimes a middle name or a patronymic.

m_librarian/db.py

index 395d667b2855f547a655683843757f0dbd411990..6e08204acfcdac30da1ec9790b2132d9e7d8df14 100755 (executable)
@@ -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)