This repository has been archived by the owner on May 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
migrations.py
67 lines (63 loc) · 1.9 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
async def m001_initial(db):
"""
Initial cashu table.
"""
await db.execute(
"""
CREATE TABLE cashu.cashu (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
name TEXT NOT NULL,
tickershort TEXT DEFAULT 'sats',
fraction BOOL,
maxsats INT,
coins INT,
keyset_id TEXT NOT NULL,
issued_sat INT
);
"""
)
"""
Initial cashus table.
"""
await db.execute(
"""
CREATE TABLE cashu.pegs (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
inout BOOL NOT NULL,
amount INT
);
"""
)
async def m002_add_mint_settings(db):
"""
Add mint options.
"""
await db.execute(
"ALTER TABLE cashu.cashu ADD COLUMN mint_max_balance INT DEFAULT 0;"
)
await db.execute(
"ALTER TABLE cashu.cashu ADD COLUMN mint_max_peg_in INT DEFAULT 0;"
)
await db.execute(
"ALTER TABLE cashu.cashu ADD COLUMN mint_max_peg_out INT DEFAULT 0;"
)
await db.execute(
"ALTER TABLE cashu.cashu ADD COLUMN mint_peg_out_only BOOL DEFAULT false;"
)
await db.execute(
"ALTER TABLE cashu.cashu ADD COLUMN mint_description TEXT DEFAULT '';"
)
await db.execute(
"ALTER TABLE cashu.cashu ADD COLUMN mint_description_long TEXT DEFAULT '';"
)
# drop cashu.pegs
await db.execute("DROP TABLE cashu.pegs;")
# clean up unused columns in cashu.cashu
# Does not work for some SQLite versions
# await db.execute("ALTER TABLE cashu.cashu DROP COLUMN issued_sat;")
# await db.execute("ALTER TABLE cashu.cashu DROP COLUMN coins;")
# await db.execute("ALTER TABLE cashu.cashu DROP COLUMN tickershort;")
# await db.execute("ALTER TABLE cashu.cashu DROP COLUMN fraction;")
# await db.execute("ALTER TABLE cashu.cashu DROP COLUMN maxsats;")