Db, first commit of work
This also touches atproto/src/lib.rs which may be a problem for the rebase~ Adds migrations and all the other stuff. Db, Commit two, everything is looking pretty Db, add atproto error support Db, rename spoor to direct, implement sessions Db, add activity ingestor, fix type name activity has its type name Authority instead of Uri for some reason? So that is no longer an issue. EVERYTHING IS STILL UNTESTED BABY~
This commit is contained in:
parent
c1b5b774d5
commit
7274be1d91
13 changed files with 248 additions and 81 deletions
45
db/migrations/20250612223204_initial_schema.sql
Normal file
45
db/migrations/20250612223204_initial_schema.sql
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
-- Add migration script here
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
|
||||
CREATE TABLE actor (
|
||||
did VARCHAR PRIMARY KEY,
|
||||
handle VARCHAR UNIQUE,
|
||||
indexed_at VARCHAR NOT NULL
|
||||
);
|
||||
CREATE INDEX actor_handle_trgm_idx ON actor USING gist (handle gist_trgm_ops);
|
||||
|
||||
CREATE TABLE session (
|
||||
uri VARCHAR PRIMARY KEY,
|
||||
cid VARCHAR NOT NULL,
|
||||
owner VARCHAR NOT NULL,
|
||||
|
||||
content VARCHAR NOT NULL,
|
||||
contentcid VARCHAR NOT NULL,
|
||||
label VARCHAR,
|
||||
-- Participants in participant
|
||||
|
||||
created_at VARCHAR,
|
||||
indexed_at VARCHAR NOT NULL,
|
||||
sort_at VARCHAR GENERATED ALWAYS AS (LEAST(created_at,indexed_at)) STORED NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE activity (
|
||||
uri VARCHAR PRIMARY KEY,
|
||||
cid VARCHAR NOT NULL,
|
||||
|
||||
session VARCHAR,
|
||||
sessioncid VARCHAR,
|
||||
-- Progress in progress
|
||||
|
||||
performed_at VARCHAR,
|
||||
created_at VARCHAR,
|
||||
indexed_at VARCHAR NOT NULL,
|
||||
sort_at VARCHAR GENERATED ALWAYS AS (LEAST(created_at,indexed_at)) STORED NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE participant (
|
||||
participantdid VARCHAR NOT NULL,
|
||||
sessionuri VARCHAR NOT NULL,
|
||||
role VARCHAR NOT NULL
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue