You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
975 B
Python
35 lines
975 B
Python
from peewee import *
|
|
from datetime import datetime
|
|
from xmrnodes import config
|
|
|
|
|
|
db = SqliteDatabase(f"{config.DATA_DIR}/sqlite.db")
|
|
|
|
class Node(Model):
|
|
id = AutoField()
|
|
url = CharField(unique=True)
|
|
is_tor = BooleanField(default=False)
|
|
available = BooleanField(default=False)
|
|
validated = BooleanField(default=False)
|
|
nettype = CharField(null=True)
|
|
last_height = IntegerField(null=True)
|
|
crypto = CharField(null=True)
|
|
datetime_entered = DateTimeField(default=datetime.utcnow)
|
|
datetime_checked = DateTimeField(default=None, null=True)
|
|
datetime_failed = DateTimeField(default=None, null=True)
|
|
fail_reason = CharField(null=True)
|
|
|
|
class Meta:
|
|
database = db
|
|
|
|
class HealthCheck(Model):
|
|
id = AutoField()
|
|
node = ForeignKeyField(Node, backref='healthchecks')
|
|
datetime = DateTimeField(default=datetime.utcnow)
|
|
health = BooleanField()
|
|
|
|
class Meta:
|
|
database = db
|
|
|
|
db.create_tables([Node, HealthCheck])
|