-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmigrations.py
More file actions
54 lines (45 loc) · 1.48 KB
/
migrations.py
File metadata and controls
54 lines (45 loc) · 1.48 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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}
);
""")
async def m002_add_password(db):
await db.execute("""
ALTER TABLE bitcoinswitch.switch
ADD COLUMN password TEXT;
""")
async def m003_disabled(db):
await db.execute("""
ALTER TABLE bitcoinswitch.switch
ADD COLUMN disabled BOOLEAN NOT NULL DEFAULT FALSE;
""")
async def m004_disposable(db):
await db.execute("""
ALTER TABLE bitcoinswitch.switch
ADD COLUMN disposable BOOLEAN NOT NULL DEFAULT TRUE;
""")