From 2c4eb2d311919ad9fb70738199ecf99bf20c9fce Mon Sep 17 00:00:00 2001
From: benj <benj@rse8.com>
Date: Thu, 1 Dec 2022 10:30:34 -0800
Subject: - basic functionality with psql and sqlite - cli helper tool

---
 .../store/sqlite/sql/write_email_validation.sql    | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 crates/secd/store/sqlite/sql/write_email_validation.sql

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

diff --git a/crates/secd/store/sqlite/sql/write_email_validation.sql b/crates/secd/store/sqlite/sql/write_email_validation.sql
new file mode 100644
index 0000000..37b13e1
--- /dev/null
+++ b/crates/secd/store/sqlite/sql/write_email_validation.sql
@@ -0,0 +1,27 @@
+insert into email_validation
+       (
+           email_validation_public_id
+           , identity_email_id
+           , attempts
+           , code
+           , is_validated
+           , created_at
+           , expires_at
+       )
+values (
+           ?1
+           , (
+               select identity_email_id
+               from identity_email
+               where identity_id = ?2
+               and email_id = ?3
+           )
+           , ?4
+           , ?5
+           , ?6
+           , ?7
+           , ?8
+) on conflict (email_validation_public_id) do update
+  set attempts       = excluded.attempts
+      , is_validated = excluded.is_validated
+      , expires_at   = excluded.expires_at;
-- 
cgit v1.2.3

