diff options
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/20250713161354_account.sql | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/migrations/20250713161354_account.sql b/migrations/20250713161354_account.sql index 367cc7b..1b967b8 100644 --- a/migrations/20250713161354_account.sql +++ b/migrations/20250713161354_account.sql @@ -6,6 +6,13 @@ create table account ( local boolean not null, ap_id text not null unique, private_key text, + avatar_url text, + description text, + user_type text not null check ( + user_type IN ('PERSON', 'APPLICATION', 'GROUP', 'ORGANIZATION', 'SERVICE') + ), + created_at timestamptz not null default now(), + updated_at timestamptz not null default now(), public_key text not null ); @@ -21,3 +28,16 @@ create index "following_pagination" on "following" ("created_at" asc); create unique index unique_username_local on account (username) where local = true; + +create or replace function set_updated_at() +returns trigger as $$ +begin + new.updated_at := now(); + return new; +end; +$$ language plpgsql; + +create trigger trigger_set_updated_at +before update on account +for each row +execute function set_updated_at(); |