aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/store/pg/sql/write_email_validation.sql
diff options
context:
space:
mode:
Diffstat (limited to 'crates/secd/store/pg/sql/write_email_validation.sql')
-rw-r--r--crates/secd/store/pg/sql/write_email_validation.sql27
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/secd/store/pg/sql/write_email_validation.sql b/crates/secd/store/pg/sql/write_email_validation.sql
new file mode 100644
index 0000000..98fc60e
--- /dev/null
+++ b/crates/secd/store/pg/sql/write_email_validation.sql
@@ -0,0 +1,27 @@
+insert into auth.email_validation
+ (
+ email_validation_public_id
+ , identity_email_id
+ , attempts
+ , code
+ , is_validated
+ , created_at
+ , expires_at
+ )
+values (
+ $1
+ , (
+ select identity_email_id
+ from auth.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;