From 91ac771400524fc42d786a9cdb4cfffb71c3f125 Mon Sep 17 00:00:00 2001 From: gourav Date: Fri, 21 Jun 2024 16:21:06 +0530 Subject: [PATCH] Updated formatting of queries --- migration.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/migration.py b/migration.py index c425405..6df1beb 100644 --- a/migration.py +++ b/migration.py @@ -37,10 +37,10 @@ def create_user_table(): def create_keys_table(): query = """ create table if not exists keys ( - user_id INTEGER, - encryption_key TEXT, - encryption_key_salt TEXT, - FOREIGN KEY (user_id) REFERENCES users (id) + user_id INTEGER, + encryption_key TEXT, + encryption_key_salt TEXT, + FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ) """ @@ -58,13 +58,13 @@ def create_keys_table(): def create_secrets_table(): query = """ create table if not exists secrets ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - user_id INTEGER, - data TEXT NOT NULL, - added_on TEXT DEFAULT CURRENT_TIMESTAMP, + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER, + data TEXT NOT NULL, + added_on TEXT DEFAULT CURRENT_TIMESTAMP, modified_on TEXT, - active BOOLEAN DEFAULT TRUE, - FOREIGN KEY (user_id) REFERENCES users(id) + active BOOLEAN DEFAULT TRUE, + FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ) """