-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql_commands.py
54 lines (41 loc) · 890 Bytes
/
sql_commands.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
create_table_users = """
CREATE TABLE IF NOT EXISTS UserInfo (
user_id INTEGER UNIQUE,
date_joined timestamp
);
"""
create_table_wallets = """
CREATE TABLE IF NOT EXISTS UserWallet (
user_id INTEGER,
wallet_name TEXT,
wallet_address TEXT NOT NULL,
wallet_phrase TEXT,
private_key TEXT,
date_created timestamp,
current_wallet INTEGER,
PRIMARY KEY (wallet_address),
FOREIGN KEY (user_id) REFERENCES UserInfo (user_id)
);
"""
create_table_txn_history = """
CREATE TABLE IF NOT EXISTS UserTxns (
txn_id GUID,
user_id INTEGER,
coin_name TEXT NOT NULL,
reciever_address TEXT,
coin_amount REAL,
amount REAL,
date_created timestamp,
PRIMARY KEY (txn_id)
);
"""
sort_wallet_by_date = """
SELECT *
FROM UserWallet WHERE user_id = ?
ORDER BY date_created DESC;
"""
sort_txns_by_date = """
SELECT *
FROM UserTxns WHERE user_id = ?
ORDER BY date_created DESC;
"""