aboutsummaryrefslogtreecommitdiffstats
path: root/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'migrations')
-rw-r--r--migrations/20260412121213_profile.sql5
-rw-r--r--migrations/20260412121235_account.sql12
2 files changed, 17 insertions, 0 deletions
diff --git a/migrations/20260412121213_profile.sql b/migrations/20260412121213_profile.sql
new file mode 100644
index 0000000..8a6a39a
--- /dev/null
+++ b/migrations/20260412121213_profile.sql
@@ -0,0 +1,5 @@
+create table profile (
+ data jsonb not null,
+ id text generated always as (data->>'id') stored,
+ primary key (id)
+);
diff --git a/migrations/20260412121235_account.sql b/migrations/20260412121235_account.sql
new file mode 100644
index 0000000..583a0c4
--- /dev/null
+++ b/migrations/20260412121235_account.sql
@@ -0,0 +1,12 @@
+create extension if not exists citext;
+
+create table account (
+ provider_id text not null,
+ provider_user_id text not null,
+ email citext not null,
+ user_data jsonb not null,
+ user_id text not null references profile(id) on delete cascade,
+ primary key (provider_id, provider_user_id)
+);
+
+create index account_email_idx on account (email);