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 ) """