summaryrefslogtreecommitdiffstats
path: root/migrations/20250713161354_account.sql
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2025-07-15 07:18:19 +0200
committerrtkay123 <dev@kanjala.com>2025-07-15 07:18:19 +0200
commitfb1c6dd357260808121e7f7b3b9e5cc200820b62 (patch)
treedcbe23e9074d22674ddf3ec69544b1baeb155918 /migrations/20250713161354_account.sql
parent9c2f80dcf4da864e6eb99007d471e5277dfbb17d (diff)
downloadsellershut-fb1c6dd357260808121e7f7b3b9e5cc200820b62.tar.bz2
sellershut-fb1c6dd357260808121e7f7b3b9e5cc200820b62.zip
chore: account table
Diffstat (limited to 'migrations/20250713161354_account.sql')
-rw-r--r--migrations/20250713161354_account.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/migrations/20250713161354_account.sql b/migrations/20250713161354_account.sql
new file mode 100644
index 0000000..4fdb61d
--- /dev/null
+++ b/migrations/20250713161354_account.sql
@@ -0,0 +1,23 @@
+create table account (
+ id varchar(36) primary key,
+ username varchar(30) not null,
+ inbox text not null,
+ outbox text,
+ local boolean,
+ ap_id text not null unique,
+ private_key text,
+ public_key text not null
+);
+
+create table following (
+ id varchar(36) primary key,
+ follower text references account(ap_id) on delete cascade,
+ followee text references account(ap_id) on delete cascade,
+ created_at timestamptz not null default now(),
+ constraint unique_following unique (follower, followee)
+);
+create index "following_pagination" on "following" ("created_at" asc);
+
+create unique index unique_username_local
+ on account (username)
+ where local = true;