wip
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
from flask_bcrypt import Bcrypt
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
if os.path.isfile("sms.db"):
|
||||
os.unlink("sms.db")
|
||||
|
||||
flask_bcrypt = Bcrypt()
|
||||
|
||||
con = sqlite3.connect("sms.db")
|
||||
cur = con.cursor()
|
||||
|
||||
# ID columns are not necessary - SQLite by default sets ROWID as INTEGER PRIMARY KEY which auto increments
|
||||
cur.execute("CREATE TABLE devices(access_key, secret_key_hash, type, name)")
|
||||
cur.execute("CREATE TABLE messages(content, ts_received, ts_sent, sender, recipient)")
|
||||
cur.execute("CREATE TABLE sim_events(sim_id, ts, note, cost, currency)")
|
||||
cur.execute("CREATE TABLE sim_cards(phone_number, device_id)")
|
||||
|
||||
pw1_hash = flask_bcrypt.generate_password_hash('pw1').decode('utf-8')
|
||||
pw2_hash = flask_bcrypt.generate_password_hash('pw2').decode('utf-8')
|
||||
cur.execute("""
|
||||
INSERT INTO devices VALUES
|
||||
('test_access_key', ?, 'PRIMARY', 'test-primary'),
|
||||
('test_access_key2', ?, 'SECONDARY', 'test-secondary')
|
||||
""", (pw1_hash, pw2_hash))
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
Reference in New Issue
Block a user