Fix SQL queries
This commit is contained in:
parent
b31f83e214
commit
d7641c2da4
@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS emails (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Make emails unique by lower-case comparison
|
-- 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 (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
id serial PRIMARY KEY,
|
id serial PRIMARY KEY,
|
||||||
|
|||||||
@ -93,7 +93,7 @@ def reset_or_create_user(cur, email, hash, is_admin):
|
|||||||
user_id = user_id[0]
|
user_id = user_id[0]
|
||||||
# update User
|
# update User
|
||||||
cur.execute(
|
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],
|
[hash, is_admin, True, True, user_id],
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user