forked from lnbits/myextension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrations.py
36 lines (30 loc) · 905 Bytes
/
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
# the migration file is where you build your database tables
# If you create a new release for your extension , remeember the migration file is like a blockchain, never edit only add!
async def m001_initial(db):
"""
Initial templates table.
"""
await db.execute(
"""
CREATE TABLE myextension.maintable (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
name TEXT NOT NULL,
total INTEGER DEFAULT 0,
lnurlpayamount INTEGER DEFAULT 0,
lnurlwithdrawamount INTEGER DEFAULT 0,
lnurlwithdraw TEXT,
lnurlpay TEXT
);
"""
)
# Here we add another field to the database
async def m002_addtip_wallet(db):
"""
Add total to templates table
"""
await db.execute(
"""
ALTER TABLE myextension.maintable ADD ticker INTEGER DEFAULT 1;
"""
)