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
2024-06-19 23:32:42 +02:00
..
graphModels feat(sources): restructure models and first implementation of pgModel 2024-06-03 23:55:30 +02:00
pgModels test(postgres): added first tests and already fixed bugs 2024-06-19 23:32:42 +02:00
const.go test(postgres): added first tests and already fixed bugs 2024-06-19 23:32:42 +02:00
README.md docs(db): removing unused entities 2024-06-04 13:07:18 +02:00

Postgres

https://www.dbdiagram.io/d

Table User {
  id string [primary key]
  created_at timestamp
}

Table Post {
  id varchar(25) [primary key]
  rating Rating
  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