-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigrations.py
78 lines (71 loc) · 1.72 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
68
69
70
71
72
73
74
75
76
77
78
async def m001_initial(db):
"""
Initial raises table. Includes lnurlpay for donating to all participants.
"""
await db.execute(
"""
CREATE TABLE raisenow.raises (
id TEXT PRIMARY KEY NOT NULL,
wallet TEXT NOT NULL,
name TEXT NOT NULL,
description TEXT,
background_image TEXT,
header_image TEXT,
live_dates TEXT,
total INTEGER DEFAULT 0,
lnurlpay TEXT
);
"""
)
async def m002_initial(db):
"""
Initial templates table.
"""
await db.execute(
"""
CREATE TABLE raisenow.participants (
id TEXT PRIMARY KEY NOT NULL,
raisenow TEXT NOT NULL,
name TEXT NOT NULL,
description TEXT,
profile_image TEXT,
lnaddress TEXT,
total INTEGER DEFAULT 0,
lnurlpay TEXT
);
"""
)
async def m003_drop_lnurlpay(db):
"""
Migration to drop lnurlpay columns from raisenow.raises and raisenow.participants.
"""
# Drop lnurlpay from raisenow.raises
await db.execute(
"""
ALTER TABLE raisenow.raises
DROP COLUMN lnurlpay;
"""
)
# Drop lnurlpay from raisenow.participants
await db.execute(
"""
ALTER TABLE raisenow.participants
DROP COLUMN lnurlpay;
"""
)
async def m004_add_lnurlpay(db):
"""
Add timestamp to templates table.
"""
await db.execute(
"""
ALTER TABLE raisenow.participants
ADD COLUMN lnurlpay TEXT;
"""
)
await db.execute(
"""
ALTER TABLE raisenow.raises
ADD COLUMN lnurlpay TEXT;
"""
)