diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-08-11 18:36:44 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-08-11 18:36:44 -0700 |
commit | c55955f42d5fff886892f5d0093ee2725a911b02 (patch) | |
tree | ee6ef85021ff9e5ded9cb436408486aa529f08b8 /youtube/subscriptions.py | |
parent | b469536ce6cbdcdfd966a15aa1ce45d8f5b42db9 (diff) | |
download | yt-local-c55955f42d5fff886892f5d0093ee2725a911b02.tar.lz yt-local-c55955f42d5fff886892f5d0093ee2725a911b02.tar.xz yt-local-c55955f42d5fff886892f5d0093ee2725a911b02.zip |
Set sqlite to respect foreign key constraints
Diffstat (limited to 'youtube/subscriptions.py')
-rw-r--r-- | youtube/subscriptions.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube/subscriptions.py b/youtube/subscriptions.py index 3cb02ff..2c7b1fa 100644 --- a/youtube/subscriptions.py +++ b/youtube/subscriptions.py @@ -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, |