mirror of
https://github.com/djohnlewis/stackdump
synced 2024-12-04 23:17:37 +00:00
Added indexes to database to speed things up.
This commit is contained in:
parent
43f49d1827
commit
f075580a2e
@ -2,7 +2,8 @@
|
||||
|
||||
# This file contains all the model definitions for the database.
|
||||
|
||||
from sqlobject import *
|
||||
from sqlobject import SQLObject, UnicodeCol, DateTimeCol, IntCol, ForeignKey, \
|
||||
DatabaseIndex
|
||||
|
||||
class Site(SQLObject):
|
||||
name = UnicodeCol()
|
||||
@ -10,6 +11,8 @@ class Site(SQLObject):
|
||||
key = UnicodeCol()
|
||||
dump_date = UnicodeCol()
|
||||
import_date = DateTimeCol()
|
||||
|
||||
siteKey_index = DatabaseIndex(key, unique=True)
|
||||
|
||||
class Badge(SQLObject):
|
||||
sourceId = IntCol()
|
||||
@ -27,6 +30,8 @@ class Comment(SQLObject):
|
||||
creationDate = DateTimeCol()
|
||||
userId = IntCol()
|
||||
|
||||
siteId_postId_index = DatabaseIndex(site, postId)
|
||||
|
||||
json_fields = [ 'id', 'score', 'text', 'creationDate', 'userId' ]
|
||||
|
||||
class User(SQLObject):
|
||||
@ -43,4 +48,6 @@ class User(SQLObject):
|
||||
aboutMe = UnicodeCol()
|
||||
views = IntCol()
|
||||
upVotes = IntCol()
|
||||
downVotes = IntCol()
|
||||
downVotes = IntCol()
|
||||
|
||||
siteId_sourceId_index = DatabaseIndex(site, sourceId, unique=True)
|
||||
|
Loading…
Reference in New Issue
Block a user