Skip to content

Commit

Permalink
Replace PK columns with peewee.AutoField in orm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dougthor42 committed Mar 28, 2019
1 parent 44f1b13 commit 4937c92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/trendlines/orm.py
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime
from pathlib import Path

from peewee import AutoField
from peewee import SqliteDatabase
from peewee import Model
from peewee import IntegerField
Expand Down Expand Up @@ -60,7 +61,7 @@ class Metric(InternalModel):
Table holding all of the Metric information.
"""

metric_id = IntegerField(primary_key=True)
metric_id = AutoField()
name = CharField(max_length=120, unique=True)
units = CharField(max_length=24, null=True)
upper_limit = FloatField(null=True)
Expand All @@ -82,7 +83,7 @@ class DataPoint(DataModel):
naive :class:`datetime.datetime` objects (no timezone info).
"""

datapoint_id = IntegerField(primary_key=True)
datapoint_id = AutoField()
metric = ForeignKeyField(Metric, backref="datapoints",
on_delete="CASCADE")
value = FloatField()
Expand Down

0 comments on commit 4937c92

Please sign in to comment.