-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmigrations.py
executable file
·54 lines (42 loc) · 1.44 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
import sqlite3
import os, json
config = json.load(open('config.json'))
database = config['database']
if os.path.exists(database):
os.remove(database)
print('[-] Database already exists. Deleting it.')
conn = sqlite3.connect(database)
print('[+] Database opened successfully.')
conn.execute('''CREATE TABLE users
(id INTEGER PRIMARY KEY AUTOINCREMENT,
telegramId TEXT,
facebookId TEXT
);''')
print('[+] Table users created successfully.')
conn.execute('''CREATE TABLE settings
(ownerId INTEGER PRIMARY KEY,
isEncrypted TEXT,
privateKey TEXT,
publicKey TEXT,
PassphraseHash TEXT,
isUnlocked TEXT DEFAULT True,
language TEXT,
defaultAcId INTEGER
);''')
print('[+] Table settings created successfully.')
conn.execute('''CREATE TABLE accounts
(id INTEGER PRIMARY KEY AUTOINCREMENT,
token TEXT NOT NULL,
msisdnHash TEXT NOT NULL,
ownerId INTEGER NOT NULL
);''')
print('[+] Table accounts created successfully.')
conn.execute('''CREATE TABLE tempdata
(ownerId INTEGER PRIMARY KEY,
registerMsisdn TEXT,
rechargeTo, TEXT,
sendSmsTo TEXT,
responseData TEXT
);''')
print('[+] Table tempdata created successfully.')
conn.close()