diff options
| author | rtkay123 <dev@kanjala.com> | 2026-02-11 08:46:55 +0200 |
|---|---|---|
| committer | rtkay123 <dev@kanjala.com> | 2026-02-11 08:46:55 +0200 |
| commit | 8e75d3af03fdd0e92f00de10eef0af2b093d1c7c (patch) | |
| tree | dc5f04c3cc495f695a7be8ce79293d49aefdc48e /migrations | |
| parent | 9fd685039613d0e9aa71eabe51d3a6272a3ace21 (diff) | |
| download | sellershut-8e75d3af03fdd0e92f00de10eef0af2b093d1c7c.tar.bz2 sellershut-8e75d3af03fdd0e92f00de10eef0af2b093d1c7c.zip | |
feat: jsonb column
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/20260210193544_profile.sql | 30 | ||||
| -rw-r--r-- | migrations/20260210194218_oauth_account.sql | 2 |
2 files changed, 8 insertions, 24 deletions
diff --git a/migrations/20260210193544_profile.sql b/migrations/20260210193544_profile.sql index f47d034..930e657 100644 --- a/migrations/20260210193544_profile.sql +++ b/migrations/20260210193544_profile.sql @@ -1,26 +1,10 @@ -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() + data jsonb not null, + id text generated always as (data->>'id') stored, + primary key (id) ); -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); +create index idx_profile_inbox on profile using gin ((data->'inbox')); +create index idx_profile_private_key_null + on profile ((data->>'private_key')) + where data->>'private_key' is null; diff --git a/migrations/20260210194218_oauth_account.sql b/migrations/20260210194218_oauth_account.sql index ce660fe..3431f85 100644 --- a/migrations/20260210194218_oauth_account.sql +++ b/migrations/20260210194218_oauth_account.sql @@ -4,7 +4,7 @@ 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, + user_id text not null references profile(id) on delete cascade, primary key (provider_id, provider_user_id) ); |
