Files
fioul/models.py

25 lines
471 B
Python

from peewee import SqliteDatabase
from peewee import Model
from peewee import AutoField, DateField, IntegerField
from peewee import IntegrityError
# SQLite database using WAL journal mode and 64MB cache.
db = SqliteDatabase("fioul.db")
class BaseModel(Model):
class Meta:
database = db
class Price(BaseModel):
id = AutoField()
date = DateField(unique=True)
price = IntegerField()
def init():
db.connect()
db.create_tables([Price])