From e00e716927087da5a93c5e465d25ec0ff6e414dd Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Fri, 25 Oct 2024 22:18:35 +1100 Subject: [PATCH] schema: Require role.email always be lowercase Otherwise it will silently fail to match in the application. --- postgres/schema.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/postgres/schema.sql b/postgres/schema.sql index c62f208..aff6d20 100644 --- a/postgres/schema.sql +++ b/postgres/schema.sql @@ -131,7 +131,8 @@ CREATE TABLE nodes ( ); CREATE TABLE roles ( - email TEXT PRIMARY KEY, + -- email should always be lowercase since that's how the auth function compares it + email TEXT PRIMARY KEY CHECK email = lower(email), name TEXT NOT NULL, editor BOOLEAN NOT NULL DEFAULT FALSE, artist BOOLEAN NOT NULL DEFAULT FALSE