-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsql_queries.py
49 lines (44 loc) · 949 Bytes
/
sql_queries.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
# sql_queries.py
CREATE_PORTFOLIOS_TABLE = '''
CREATE TABLE IF NOT EXISTS portfolios (
id INTEGER PRIMARY KEY,
name TEXT,
currency TEXT,
deleted INTEGER DEFAULT 0
)
'''
CREATE_TRANSACTIONS_TABLE = '''
CREATE TABLE IF NOT EXISTS transactions (
id INTEGER PRIMARY KEY,
portfolio_id INTEGER,
coin_id TEXT,
amount REAL,
price_per_coin REAL,
date TEXT,
transaction_type TEXT,
FOREIGN KEY (portfolio_id) REFERENCES portfolios(id)
)
'''
CREATE_COINS_TABLE = '''
CREATE TABLE IF NOT EXISTS coins (
id INTEGER PRIMARY KEY,
coin_id TEXT,
coin_data TEXT,
last_updated TEXT
)
'''
CREATE_CRYPTOLOOKUP_TABLE = '''
CREATE TABLE IF NOT EXISTS crypto_lookup (
coin_id TEXT PRIMARY KEY,
symbol TEXT,
name TEXT
)
'''
CREATE_HISTORY_TABLE = '''
CREATE TABLE IF NOT EXISTS history (
id INTEGER PRIMARY KEY,
portfolio_id INTEGER,
portfolio_data TEXT,
last_updated TEXT
)
'''