Set sqlite to respect foreign key constraints
This commit is contained in:
parent
b469536ce6
commit
c55955f42d
@ -27,9 +27,10 @@ def open_database():
|
|||||||
os.makedirs(settings.data_dir)
|
os.makedirs(settings.data_dir)
|
||||||
connection = sqlite3.connect(database_path, check_same_thread=False)
|
connection = sqlite3.connect(database_path, check_same_thread=False)
|
||||||
|
|
||||||
# Create tables if they don't exist
|
|
||||||
try:
|
try:
|
||||||
cursor = connection.cursor()
|
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 (
|
cursor.execute('''CREATE TABLE IF NOT EXISTS subscribed_channels (
|
||||||
id integer PRIMARY KEY,
|
id integer PRIMARY KEY,
|
||||||
yt_channel_id text UNIQUE NOT NULL,
|
yt_channel_id text UNIQUE NOT NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user