From da6ab098acacf6233542a591110f8b28ffd298ed Mon Sep 17 00:00:00 2001
From: rtkay123 <dev@kanjala.com>
Date: Wed, 16 Jul 2025 08:55:14 +0200
Subject: build: update tbl

---
 migrations/20250713161354_account.sql | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

(limited to 'migrations/20250713161354_account.sql')

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();
-- 
cgit v1.2.3

