aboutsummaryrefslogtreecommitdiff
path: root/store/sqlite/migrations
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2022-11-25 16:42:16 -0800
committerbenj <benj@rse8.com>2022-11-25 16:42:16 -0800
commitaa8c20d501b58001a5e1b24964c62363e2112ff8 (patch)
tree82e53aa5efd6e0a96e8c436655c083de617a6131 /store/sqlite/migrations
parentfcd972fd9ae7579724b0ba9b401ceb729e6e0108 (diff)
downloadsecdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.tar
secdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.tar.gz
secdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.tar.bz2
secdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.tar.lz
secdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.tar.xz
secdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.tar.zst
secdiam-aa8c20d501b58001a5e1b24964c62363e2112ff8.zip
some shell is coming together and a rough API
Diffstat (limited to '')
-rw-r--r--store/sqlite/migrations/20221125051738_bootstrap.sql32
1 files changed, 32 insertions, 0 deletions
diff --git a/store/sqlite/migrations/20221125051738_bootstrap.sql b/store/sqlite/migrations/20221125051738_bootstrap.sql
new file mode 100644
index 0000000..70a8892
--- /dev/null
+++ b/store/sqlite/migrations/20221125051738_bootstrap.sql
@@ -0,0 +1,32 @@
+create table if not exists identity (
+ identity_id integer primary key autoincrement
+ , identity_public_id uuid
+ , data text default '{}'
+ , created_at timestamp not null default current_timestamp
+ , unique(identity_public_id)
+);
+
+create table if not exists email (
+ email_id integer primary key autoincrement
+ , address text not null
+ , unique(address)
+);
+
+create table if not exists identity_email (
+ identity_email_id integer primary key autoincrement
+ , identity_id integer not null references identity(identity_id)
+ , email_id integer not null references email(email_id)
+ , created_at timestamp not null default current_timestamp
+ , deleted_at timestamp not null default current_timestamp
+);
+
+create table if not exists email_validation_request (
+ email_validation_request_id integer primary key autoincrement
+ -- uuid
+ , email_validation_request_public_id text not null
+ , identity_email_id integer not null references identity_email(identity_email_id)
+ , is_validated boolean not null default false
+ , created_at timestamp not null default current_timestamp
+ , expires_at timestamp
+ , revoked_at timestamp
+);