summaryrefslogtreecommitdiffstats
path: root/adenosine-pds/src/atp_db.sql
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-11-08 19:06:05 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-11-08 19:06:05 -0800
commitb8eea211866766aabde8c5e55d1061deb799ddc6 (patch)
treeef11ca35c7bdd8b80744bfe7ba71a299e737ade3 /adenosine-pds/src/atp_db.sql
parent02cd7b33d090db2aa47126a4d1aeecb247e7b7ef (diff)
downloadadenosine-b8eea211866766aabde8c5e55d1061deb799ddc6.tar.gz
adenosine-b8eea211866766aabde8c5e55d1061deb799ddc6.zip
pds: start implementing bsky database ops and XRPC endpoints
Diffstat (limited to 'adenosine-pds/src/atp_db.sql')
-rw-r--r--adenosine-pds/src/atp_db.sql25
1 files changed, 9 insertions, 16 deletions
diff --git a/adenosine-pds/src/atp_db.sql b/adenosine-pds/src/atp_db.sql
index b356abc..71fbf6d 100644
--- a/adenosine-pds/src/atp_db.sql
+++ b/adenosine-pds/src/atp_db.sql
@@ -40,33 +40,26 @@ CREATE TABLE bsky_post(
);
CREATE INDEX bsky_post_reply_root_uri_idx on bsky_post(reply_root_uri);
-CREATE TABLE bsky_repost(
- did TEXT NOT NULL,
- subject_uri TEXT NOT NULL,
- cid TEXT NOT NULL,
- created_at TIMESTAMP WITH TIME ZONE NOT NULL,
- indexed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT ( DATETIME('now') ),
- PRIMARY KEY(did, subject_uri)
-);
-CREATE INDEX bsky_repost_subject_uri_idx on bsky_repost(subject_uri);
-
-CREATE TABLE bsky_like(
+CREATE TABLE bsky_ref(
+ ref_type TEXT NOT NULL,
did TEXT NOT NULL,
+ tid TEXT NOT NULL,
subject_uri TEXT NOT NULL,
- cid TEXT NOT NULL,
+ subject_cid TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
indexed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT ( DATETIME('now') ),
- PRIMARY KEY(did, subject_uri)
+ PRIMARY KEY(ref_type, did, tid)
);
-CREATE INDEX bsky_like_subject_uri_idx on bsky_like(subject_uri);
+CREATE INDEX bsky_ref_subject_uri_idx on bsky_ref(subject_uri);
CREATE TABLE bsky_follow(
did TEXT NOT NULL,
+ tid TEXT NOT NULL,
subject_did TEXT NOT NULL,
- cid TEXT NOT NULL,
+ subject_cid TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
indexed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT ( DATETIME('now') ),
- PRIMARY KEY(did, subject_did)
+ PRIMARY KEY(did, tid)
);
CREATE INDEX bsky_follow_subject_did_idx on bsky_follow(subject_did);