Download:
child 340:2d97d5a9d437
parent 338:26c9302e61e1
339:641a6a8ee1b6
Anton Shestakov <av6@dwimlabs.net>, Wed, 30 May 2018 18:20:33 +0800
requirements: peewee 3.5.0 Moving +1 to select clause because "<query> + x" is now interpreted as "<query> UNION ALL x". Database.create_tables() now defaults to safe=True.

4 файлов изменено, 9 вставок(+), 10 удалений(-) [+]
candolint/models.py file | annotate | diff | comparison | revisions
incoming.py file | annotate | diff | comparison | revisions
requirements.txt file | annotate | diff | comparison | revisions
run-tests.py file | annotate | diff | comparison | revisions
--- a/candolint/models.py Wed May 30 17:54:54 2018 +0800
+++ b/candolint/models.py Wed May 30 18:20:33 2018 +0800
@@ -5,7 +5,7 @@
from candolint import adapters
-database = pw.SqliteDatabase(None, journal_mode='WAL')
+database = pw.SqliteDatabase(None, pragmas={'journal_mode': 'wal'})
class BaseModel(pw.Model):
@@ -73,7 +73,7 @@
author = pw.CharField()
message = pw.CharField()
- project = pw.ForeignKeyField(Project, related_name='changes')
+ project = pw.ForeignKeyField(Project, backref='changes')
class Meta:
indexes = (
@@ -90,8 +90,8 @@
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')
class Meta:
indexes = (
@@ -110,10 +110,9 @@
@classmethod
def get_next_ordinal(cls, project):
- max_ordinal = (cls
- .select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0))
+ return (cls
+ .select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0) + 1)
.where(cls.project == project))
- return max_ordinal + 1
@classmethod
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
@@ -212,7 +212,7 @@
database.init(rel('database.sqlite'))
database.connect()
- database.create_tables([Project, Change, Check], safe=True)
+ database.create_tables([Project, Change, Check])
if args.debug:
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
@@ -1,4 +1,4 @@
-peewee==2.10.2
+peewee==3.5.0
PyYAML==3.12
redis==2.10.6
tornado==4.5.3
--- a/run-tests.py Wed May 30 17:54:54 2018 +0800
+++ b/run-tests.py Wed May 30 18:20:33 2018 +0800
@@ -10,7 +10,7 @@
def main():
database.init(':memory:')
database.connect()
- database.create_tables([Project, Change, Check], safe=True)
+ database.create_tables([Project, Change, Check])
database.init = Mock()
database.connect = Mock()
database.close = Mock()