-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrations.py
37 lines (34 loc) · 1.02 KB
/
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
37
from lnbits.db import Database
db = Database("ext_bitcoinswitch")
async def m001_initial(db):
"""
Initial bitcoinswitch table.
"""
await db.execute(
f"""
CREATE TABLE bitcoinswitch.switch (
id TEXT NOT NULL PRIMARY KEY,
key TEXT NOT NULL,
title TEXT NOT NULL,
wallet TEXT NOT NULL,
currency TEXT NOT NULL,
switches TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now},
updated_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
);
"""
)
await db.execute(
f"""
CREATE TABLE bitcoinswitch.payment (
id TEXT NOT NULL PRIMARY KEY,
bitcoinswitch_id TEXT NOT NULL,
payment_hash TEXT,
payload TEXT NOT NULL,
pin INT,
sats {db.big_int},
created_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now},
updated_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
);
"""
)