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(