aboutsummaryrefslogtreecommitdiffstats
path: root/migrations
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2026-02-10 23:38:02 +0200
committerrtkay123 <dev@kanjala.com>2026-02-10 23:38:02 +0200
commit4f30128feb0715f05c103fec20aa6cba61e60984 (patch)
tree8291d4accb1bdf98c9afb0dca9686aa34880c62f /migrations
parent375da0e07f2b3e88c2f6db0e6f4565b3ad555b95 (diff)
downloadsellershut-4f30128feb0715f05c103fec20aa6cba61e60984.tar.bz2
sellershut-4f30128feb0715f05c103fec20aa6cba61e60984.zip
feat: db create account
Diffstat (limited to 'migrations')
-rw-r--r--migrations/20260210193544_profile.sql26
-rw-r--r--migrations/20260210194218_oauth_account.sql11
2 files changed, 37 insertions, 0 deletions
diff --git a/migrations/20260210193544_profile.sql b/migrations/20260210193544_profile.sql
new file mode 100644
index 0000000..f47d034
--- /dev/null
+++ b/migrations/20260210193544_profile.sql
@@ -0,0 +1,26 @@
+create type actor_kind as enum (
+ 'application',
+ 'group',
+ 'organization',
+ 'person',
+ 'service'
+);
+
+create table profile (
+ ap_id text primary key,
+ username varchar(15),
+ description varchar(255),
+ inbox text not null,
+ role actor_kind not null default 'person',
+ outbox text,
+ picture text,
+ public_key text not null,
+ private_key text,
+ created_at timestamptz not null default now(),
+ last_refreshed_at timestamptz not null default now()
+);
+
+create index user_inbox_idx on profile (inbox);
+create index user_outbox_idx on profile (outbox);
+create index user_role_idx on profile (role);
+create index user_username_idx on profile (username);
diff --git a/migrations/20260210194218_oauth_account.sql b/migrations/20260210194218_oauth_account.sql
new file mode 100644
index 0000000..ce660fe
--- /dev/null
+++ b/migrations/20260210194218_oauth_account.sql
@@ -0,0 +1,11 @@
+create extension if not exists citext;
+
+create table account (
+ provider_id text not null,
+ provider_user_id text not null,
+ email citext not null,
+ ap_id text not null references profile(ap_id) on delete cascade,
+ primary key (provider_id, provider_user_id)
+);
+
+create index account_email_idx on account (email);