-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
645 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ RUN yarn | |
COPY tsconfig.json . | ||
|
||
COPY src ./src | ||
COPY kv-migrate ./kv-migrate | ||
|
||
EXPOSE 8080 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.