import logging from peewee import SqliteDatabase, Model, CharField, DateField, ForeignKeyField from textual.logging import TextualHandler logger = logging.getLogger('peewee') logger.addHandler(TextualHandler()) logger.setLevel(logging.DEBUG) db = SqliteDatabase(None) class HamsterCategory(Model): name = CharField() class Meta: database = db table_name = 'categories' class HamsterActivity(Model): name = CharField() category = ForeignKeyField(HamsterCategory, backref='activities') class Meta: database = db table_name = 'activities' class HamsterFact(Model): activity = ForeignKeyField(HamsterActivity, backref='facts') class Meta: database = db table_name = 'facts' class KimaiCustomer(Model): name = CharField() class Meta: database = db table_name = 'kimai_customers' class KimaiProject(Model): name = CharField() customer = ForeignKeyField(KimaiCustomer, backref='projects') class Meta: database = db table_name = 'kimai_projects' class KimaiActivity(Model): name = CharField() project = ForeignKeyField(KimaiProject, backref='activities') class Meta: database = db table_name = 'kimai_activities'