blob: 702449b3a21150229333d042e3f7ae8fd5101bca (
plain)
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
|
import os
import sqlite3
import initialize_variables
"""
This function is run before the application starts - creates database and sets connection string
"""
def setup_db():
IN_DOCKER = os.environ.get('IN_DOCKER', False)
if IN_DOCKER:
db = sqlite3.connect('/data/movies.db')
initialize_variables.db_path = '/data/movies.db'
else:
db = sqlite3.connect('movies.db')
initialize_variables.db_path = 'movies.db'
cursor = db.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS movies(
from_number TEXT,
movie_id TEXT,
movie_title TEXT
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS jellyfin_accounts(
user_id TEXT,
deletion_time DATETIME
)
''')
db.commit()
db.close()
|