Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mike182uk committed Sep 20, 2024
1 parent 9e9321f commit 47ac4a6
Show file tree
Hide file tree
Showing 7 changed files with 645 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN yarn
COPY tsconfig.json .

COPY src ./src
COPY kv-migrate ./kv-migrate

EXPOSE 8080

Expand Down
106 changes: 106 additions & 0 deletions kv-migrate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Migrate from kv to db

## Schema

```mermaid
erDiagram
SITES {
int id PK
varchar hostname
datetime created_at
}
USERS {
int id PK
int site_id FK
varchar name
varchar username
varchar bio
varchar avatar
json public_key
json private_key
datetime created_at
datetime updated_at
}
ACTORS {
int id PK
varchar uri
json json_ld
datetime created_at
}
OBJECTS {
int id PK
varchar uri
enum type
json json_ld
datetime created_at
}
ACTIVITIES {
int id PK
varchar uri
enum type
json json_ld
datetime created_at
}
USER_INBOX {
int id PK
int user_id FK
int activity_id FK
datetime created_at
}
USER_OUTBOX {
int id PK
int user_id FK
int activity_id FK
datetime created_at
}
USER_FOLLOWERS {
int id PK
int user_id FK
int actor_id FK
datetime created_at
}
USER_FOLLOWING {
int id PK
int user_id FK
int actor_id FK
datetime created_at
}
USER_LIKED {
int id PK
int user_id FK
int object_id FK
datetime created_at
}
USERS ||--o{ SITES : "site_id"
USER_INBOX ||--o{ USERS : "user_id"
USER_INBOX ||--o{ ACTIVITIES : "activity_id"
USER_OUTBOX ||--o{ USERS : "user_id"
USER_OUTBOX ||--o{ ACTIVITIES : "activity_id"
USER_FOLLOWERS ||--o{ USERS : "user_id"
USER_FOLLOWERS ||--o{ ACTORS : "actor_id"
USER_FOLLOWING ||--o{ USERS : "user_id"
USER_FOLLOWING ||--o{ ACTORS : "actor_id"
USER_LIKED ||--o{ USERS : "user_id"
USER_LIKED ||--o{ OBJECTS : "object_id"
```

- **sites** - TODO
- **users** - TODO
- **actors** - Fediverse actors
- **objects** - Fediverse objects
- **activities** - Fediverse activities
- **user_inbox** - Pivot table for users and the activities in their inbox
- **user_outbox** - Pivot table for users and the activities in their outbox
- **user_liked** - Pivot table for users and the objects they have liked
- **user_followers** - Pivot table for users and the actors that follow them
- **user_following** - Pivot table for users and the actors they follow
Loading

0 comments on commit 47ac4a6

Please sign in to comment.