forked from BitcoinTaps/partytap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigrations.py
38 lines (32 loc) · 867 Bytes
/
migrations.py
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
34
35
36
import json
from lnbits.db import Database
async def m001_initial(db):
"""
Initial device table.
"""
await db.execute(
f"""
CREATE TABLE partytap.device (
id TEXT NOT NULL PRIMARY KEY,
key TEXT NOT NULL,
title TEXT NOT NULL,
wallet TEXT NOT NULL,
currency TEXT NOT NULL,
switches TEXT,
timestamp TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
);
"""
)
await db.execute(
f"""
CREATE TABLE partytap.payment (
id TEXT NOT NULL PRIMARY KEY,
deviceid TEXT NOT NULL,
switchid TEXT NOT NULL,
payhash TEXT,
payload TEXT NOT NULL,
sats {db.big_int},
timestamp TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
);
"""
)