-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdb.py
More file actions
executable file
·33 lines (24 loc) · 826 Bytes
/
Copy pathdb.py
File metadata and controls
executable file
·33 lines (24 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from peewee import * # type: ignore
DATABASE = 'tmp/main.db'
database = SqliteDatabase(DATABASE)
class BaseModel(Model):
class Meta:
database = database
class MeshtasticNode(BaseModel):
node_id = CharField(unique=True)
long_name = CharField()
short_name = CharField()
last_seen = IntegerField()
public_key = CharField()
lxmf_identity = TextField(null=True)
class MeshtasticMessage(BaseModel):
message_id = IntegerField(primary_key=True)
author = ForeignKeyField(MeshtasticNode, backref='messages')
content = CharField()
received = IntegerField()
class LXMFUser(BaseModel):
identity_hash = CharField(unique=True)
name = CharField()
is_subscribed = BooleanField()
log = TextField()
database.create_tables([MeshtasticNode, MeshtasticMessage, LXMFUser])