Set sqlite to respect foreign key constraints

This commit is contained in:
James Taylor 2019-08-11 18:36:44 -07:00
parent b469536ce6
commit c55955f42d

View File

@ -27,9 +27,10 @@ def open_database():
os.makedirs(settings.data_dir)
connection = sqlite3.connect(database_path, check_same_thread=False)
# Create tables if they don't exist
try:
cursor = connection.cursor()
cursor.execute('''PRAGMA foreign_keys = 1''')
# Create tables if they don't exist
cursor.execute('''CREATE TABLE IF NOT EXISTS subscribed_channels (
id integer PRIMARY KEY,
yt_channel_id text UNIQUE NOT NULL,