25 lines
494 B
Python
25 lines
494 B
Python
import sqlite3
|
|
|
|
|
|
def connect_db():
|
|
conn = sqlite3.connect('database/database.sqlite')
|
|
conn.execute("PRAGMA foreign_keys = 1")
|
|
return conn
|
|
|
|
|
|
CREATE_USER_QUERY = """
|
|
INSERT INTO
|
|
users (
|
|
name, email, username, password
|
|
)
|
|
VALUES (
|
|
:name, :email, :username, :password
|
|
)
|
|
returning id
|
|
"""
|
|
|
|
CREATE_KEY_QUERY = """
|
|
INSERT INTO
|
|
keys (user_id, encryption_key, encryption_key_salt)
|
|
VALUES (:user_id, :encryption_key, :encryption_key_salt)
|
|
""" |