From 0920c4d4f30a3345870d385d5c6f3e0919228b56 Mon Sep 17 00:00:00 2001
From: benj <benj@rse8.com>
Date: Mon, 12 Dec 2022 17:06:57 -0800
Subject: (oauth2 + email added): a mess that may or may not really work and
 needs to be refactored...

---
 crates/secd/store/sqlite/sql/find_email_validation.sql | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'crates/secd/store/sqlite/sql/find_email_validation.sql')

diff --git a/crates/secd/store/sqlite/sql/find_email_validation.sql b/crates/secd/store/sqlite/sql/find_email_validation.sql
index a34c149..d7f311c 100644
--- a/crates/secd/store/sqlite/sql/find_email_validation.sql
+++ b/crates/secd/store/sqlite/sql/find_email_validation.sql
@@ -2,15 +2,17 @@ select
         ev.email_validation_public_id
         , i.identity_public_id
         , e.address
-        , ev.attempts
         , ev.code
-        , ev.is_validated
+        , ev.is_oauth_derived
         , ev.created_at
-        , ev.expires_at
-        , ev.revoked_at
-from email_validation ev
-join identity_email   ie using (identity_email_id)
-join email            e  using (email_id)
-join identity         i  using (identity_id)
+        , ev.expired_at
+        , ev.validated_at
+        , iev.revoked_at
+        , iev.deleted_at
+from email_validation               ev
+join email                          e   using (email_id)
+left join identity_email_validation iev using (email_validation_id)
+left join identity                  i   using (identity_id)
 where ((?1 is null) or (email_validation_public_id = ?1))
 and   ((?2 is null) or (code = ?2));
+--
-- 
cgit v1.2.3

