--- a/candolint/models.py Wed May 30 17:54:54 2018 +0800
+++ b/candolint/models.py Wed May 30 18:20:33 2018 +0800
from candolint import adapters
-database = pw.SqliteDatabase(None, journal_mode='WAL')
+database = pw.SqliteDatabase(None, pragmas={'journal_mode': 'wal'})
class BaseModel(pw.Model):
- project = pw.ForeignKeyField(Project, related_name='changes')
+ project = pw.ForeignKeyField(Project, backref='changes')
started = pw.DateTimeField()
finished = pw.DateTimeField()
- project = pw.ForeignKeyField(Project, related_name='checks')
- change = pw.ForeignKeyField(Change, related_name='checks')
+ project = pw.ForeignKeyField(Project, backref='checks')
+ change = pw.ForeignKeyField(Change, backref='checks')
def get_next_ordinal(cls, project):
- .select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0))
+ .select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0) + 1)
.where(cls.project == project))
def get_light_fields(cls):
--- a/incoming.py Wed May 30 17:54:54 2018 +0800
+++ b/incoming.py Wed May 30 18:20:33 2018 +0800
database.init(rel('database.sqlite'))
- database.create_tables([Project, Change, Check], safe=True)
+ database.create_tables([Project, Change, Check])
logger = logging.getLogger('peewee')
logger.setLevel(logging.DEBUG)
--- a/requirements.txt Wed May 30 17:54:54 2018 +0800
+++ b/requirements.txt Wed May 30 18:20:33 2018 +0800
--- a/run-tests.py Wed May 30 17:54:54 2018 +0800
+++ b/run-tests.py Wed May 30 18:20:33 2018 +0800
database.init(':memory:')
- database.create_tables([Project, Change, Check], safe=True)
+ database.create_tables([Project, Change, Check])
database.connect = Mock()