forked from lnbits/events
-
Notifications
You must be signed in to change notification settings - Fork 1
/
migrations.py
46 lines (44 loc) · 1.31 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
async def m001_initial(db):
await db.execute(
"""
CREATE TABLE bets4sats.competitions (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
register_id TEXT NOT NULL,
name TEXT NOT NULL,
info TEXT NOT NULL,
banner TEXT NOT NULL,
closing_datetime TEXT NOT NULL,
amount_tickets INTEGER NOT NULL,
min_bet INTEGER NOT NULL,
max_bet INTEGER NOT NULL,
sold INTEGER NOT NULL,
choices TEXT NOT NULL,
winning_choice INTEGER NOT NULL,
state TEXT NOT NULL,
time TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """
);
"""
)
async def m002_changed(db):
await db.execute(
"""
CREATE TABLE bets4sats.tickets (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
competition TEXT NOT NULL,
amount INTEGER NOT NULL,
reward_target TEXT NOT NULL,
choice INTEGER NOT NULL,
state TEXT NOT NULL,
reward_msat INTEGER NOT NULL,
reward_failure TEXT NOT NULL,
reward_payment_hash TEXT NOT NULL,
time TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """
);
"""
)