From d7641c2da468c74ac2e9d27a10287c0a546b130f Mon Sep 17 00:00:00 2001 From: Finn Stutzenstein Date: Sun, 6 Mar 2022 09:53:34 +0100 Subject: [PATCH] Fix SQL queries --- max/db/schema.sql | 2 +- max/db/users.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/max/db/schema.sql b/max/db/schema.sql index 2da7de4..9dbe970 100644 --- a/max/db/schema.sql +++ b/max/db/schema.sql @@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS emails ( ); -- Make emails unique by lower-case comparison -CREATE UNIQUE INDEX email_unique_idx on emails (LOWER(email)); +CREATE UNIQUE INDEX IF NOT EXISTS email_unique_idx on emails (LOWER(email)); CREATE TABLE IF NOT EXISTS users ( id serial PRIMARY KEY, diff --git a/max/db/users.py b/max/db/users.py index e68babb..b30c0db 100644 --- a/max/db/users.py +++ b/max/db/users.py @@ -93,7 +93,7 @@ def reset_or_create_user(cur, email, hash, is_admin): user_id = user_id[0] # update User cur.execute( - "UPDATE users SET passwordhash=%s, is_admin=%s, enabled=%s can_receive=%s WHERE id=%s", # noqa + "UPDATE users SET passwordhash=%s, is_admin=%s, enabled=%s, can_receive=%s WHERE id=%s", # noqa [hash, is_admin, True, True, user_id], ) print(