This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/pkg/models/README.md

87 lines
1.3 KiB
Markdown
Raw Normal View History

# Postgres
https://www.dbdiagram.io/d
````
Table User {
id string [primary key]
created_at timestamp
}
Table Post {
id varchar(25) [primary key]
rating Rating
body text [note: 'Content of the post']
user_id integer
status post_status
created_at timestamp
}
Enum Rating {
safe
questionable
explicit
}
Table Source {
id varchar(25) [primary key]
display_name text
domain text [not null, unique]
}
Table Tag {
name text [primary key]
type TagType
}
Enum TagType {
general
species
character
artist
lore
meta
invalid
}
Table TagAlias {
name text [primary key]
tag_id text
}
Table TagGroup {
name text [primary key]
tag_id text
}
Table UserFavorites {
user_id text [primary key]
post_id text [primary key]
created_at timestamp
}
Table UserSource {
user_id text [primary key]
source_id text [primary key]
account_username text
account_id text
}
Table PostReference {
post_id text [primary key]
source_id text [primary key]
url text [not null, unique]
source_post_id text
}
Ref: Tag.name > TagAlias.tag_id
Ref: Tag.name > TagGroup.tag_id
Ref: Tag.name <> Post.id
Ref: UserFavorites.user_id > User.id
Ref: UserFavorites.post_id > Post.id
Ref: UserSource.user_id > User.id
Ref: UserSource.source_id > Source.id
Ref: PostReference.post_id > Post.id
Ref: PostReference.source_id > Source.id
````