-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
38 lines (30 loc) · 1.07 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# From [config.py](config.html).
import config
from peewee import (Model, ForeignKeyField, DateTimeField, TextField,
IntegerField)
class BaseModel(Model):
"""Used to set up the database target for all models."""
class Meta:
database = config.DatabaseConfig.peewee_db
class User(BaseModel):
"""Represents a MediaWiki user."""
user_id = TextField()
username = TextField()
class Page(BaseModel):
"""Represents a MediaWiki page."""
page_id = IntegerField()
page_title = TextField()
class Change(BaseModel):
"""
Represents a MediaWiki change (from Recent Changes, viewable at
[Special:RecentChanges](http://www.mediawiki.org/wiki/Help:Recent_changes)
or accessible
[via the MediaWiki API](http://www.mediawiki.org/wiki/API:Recentchanges).)
"""
change_id = IntegerField()
change_type = TextField()
user = ForeignKeyField(User, related_name='changes')
timestamp = DateTimeField()
page = ForeignKeyField(Page, related_name='changes')
comment = TextField()
size_diff = IntegerField()