Skip to content

Database Model

Adrian Rocke edited this page Jan 30, 2025 · 1 revision

Users

erDiagram
  reset_password_token{
    ~uuid~ user_id
    ~text~ token
    ~bigint~ expires
  }

  session{
    ~text~ id
    ~uuid~ user_id
    ~timestamp(3) without time zone~ expires_at
  }

  users{
    ~uuid~ id
    ~text~ name
    ~email_status~ email_status
    ~text~ email
    ~text~ hashed_password
    ~user_status~ status
  }

  user_email_verification{
    ~uuid~ user_id
    ~text~ email
    ~text~ token
    ~bigint~ expires
  }

  user_invitation{
    ~uuid~ user_id
    ~text~ token
    ~bigint~ expires
  }

  user_system_role{
    ~uuid~ user_id
    ~system_role~ role
  }

  session }|..|| users : session_user_id_fkey
  user_email_verification }|..|| users : user_email_verification_user_id_fkey
  user_invitation }|..|| users : user_invitation_user_id_fkey
  user_system_role }|..|| users : user_system_role_user_id_fkey
  reset_password_token }|..|| users : reset_password_token_user_id_fkey
Loading

Languages

erDiagram
  language{
    ~uuid~ id
    ~text~ code
    ~text~ name
    ~text~ font
    ~text[]~ translation_ids
    ~text_direction~ text_direction
  }

  language_import_job{
    ~uuid~ language_id
    ~timestamp(3) without time zone~ start_date
    ~timestamp(3) without time zone~ end_date
    ~boolean~ succeeded
    ~uuid~ user_id
  }

  language_member_role{
    ~uuid~ user_id
    ~uuid~ language_id
    ~language_role~ role
  }

  language_member_role }|..|| users : language_member_role_user_id_fkey
  language_member_role }|..|| language : language_member_role_language_id_fkey
  language_import_job }|..|| language : language_import_job_language_id_fkey
  language_import_job }|..|| users : language_import_job_user_id_fkey
Loading

Bible

erDiagram
  book{
    ~integer~ id
    ~text~ name
  }

  lemma{
    ~text~ id
  }

  lemma_form{
    ~text~ id
    ~text~ grammar
    ~text~ lemma_id
  }

  lemma_resource{
    ~text~ lemma_id
    ~resource_code~ resource_code
    ~text~ content
  }

  recording{
    ~text~ id
    ~text~ name
  }

  verse{
    ~text~ id
    ~integer~ number
    ~integer~ book_id
    ~integer~ chapter
  }

  verse_audio_timing{
    ~integer~ id
    ~text~ verse_id
    ~text~ recording_id
    ~double precision~ start
    ~double precision~ end
  }

  word{
    ~text~ id
    ~text~ text
    ~text~ verse_id
    ~text~ form_id
  }

  lemma_form }|..|| lemma : lemma_form_lemma_id_fkey
  lemma_resource }|..|| lemma : lemma_resource_lemma_id_fkey
  verse }|..|| book : verse_book_id_fkey
  verse_audio_timing }|..|| verse : verse_audio_timing_verse_id_fkey
  verse_audio_timing }|..|| recording : verse_audio_timing_recording_id_fkey
  word }|..|| verse : word_verse_id_fkey
  word }|..|| lemma_form : word_form_id_fkey
Loading

Translation

erDiagram
  footnote{
    ~uuid~ author_id
    ~timestamp(3) without time zone~ timestamp
    ~text~ content
    ~integer~ phrase_id
  }

  gloss{
    ~text~ gloss
    ~gloss_state~ state
    ~integer~ phrase_id
    ~gloss_source~ source
    ~timestamp without time zone~ updated_at
    ~uuid~ updated_by
  }

  gloss_history{
    ~integer~ id
    ~integer~ phrase_id
    ~text~ gloss
    ~gloss_state~ state
    ~gloss_source~ source
    ~timestamp without time zone~ updated_at
    ~uuid~ updated_by
  }

  lemma_form_suggestion{
    ~integer~ id
    ~uuid~ language_id
    ~text~ form_id
    ~text~ gloss
    ~integer~ count
  }
  
  machine_gloss{
    ~text~ word_id
    ~uuid~ language_id
    ~text~ gloss
    ~integer~ id
    ~integer~ model_id
    ~timestamp without time zone~ updated_at
    ~uuid~ updated_by
  }

  machine_gloss_history{
    ~integer~ id
    ~integer~ machine_gloss_id
    ~text~ gloss
    ~timestamp without time zone~ updated_at
    ~uuid~ updated_by
  }

  machine_gloss_model{
    ~integer~ id
    ~text~ code
  }

  phrase{
    ~integer~ id
    ~uuid~ language_id
    ~timestamp(3) without time zone~ created_at
    ~uuid~ created_by
    ~timestamp(3) without time zone~ deleted_at
    ~uuid~ deleted_by
  }

  phrase_word{
    ~integer~ phrase_id
    ~text~ word_id
  }

  translator_note{
    ~uuid~ author_id
    ~timestamp(3) without time zone~ timestamp
    ~text~ content
    ~integer~ phrase_id
  }

  lemma_form_suggestion }|..|| language : lemma_form_suggestion_language_id_fkey
  lemma_form_suggestion }|..|| lemma_form : lemma_form_suggestion_form_id_fkey
  footnote }|..|| phrase : footnote_phrase_id_fkey
  footnote }|..|| users : footnote_author_id_fkey
  machine_gloss }|..|| word : machine_gloss_word_id_fkey
  machine_gloss }|..|| language : machine_gloss_language_id_fkey
  machine_gloss }|..|| users : machine_gloss_updated_by_fkey
  machine_gloss }|..|| machine_gloss_model : machine_gloss_model_id_fkey
  phrase }|..|| language : phrase_language_id_fkey
  phrase }|..|| users : phrase_deleted_by_fkey
  phrase }|..|| users : phrase_created_by_fkey
  phrase_word }|..|| word : phrase_word_word_id_fkey
  phrase_word }|..|| phrase : phrase_word_phrase_id_fkey
  translator_note }|..|| phrase : translator_note_phase_id_fkey
  translator_note }|..|| users : translator_note_author_id_fkey
  gloss_history }|..|| phrase : gloss_history_phrase_id_fkey
  gloss }|..|| users : gloss_updated_by_fkey
  gloss }|..|| phrase : gloss_phrase_id_fkey
  machine_gloss_history }|..|| users : machine_gloss_history_updated_by_fkey
  machine_gloss_history }|..|| machine_gloss : machine_gloss_history_machine_gloss_id_fkey
Loading

Analytics

erDiagram
  weekly_gloss_statistics{
    ~integer~ id
    ~timestamp without time zone~ week
    ~uuid~ language_id
    ~integer~ book_id
    ~uuid~ user_id
    ~integer~ approved_count
    ~integer~ unapproved_count
  }

  weekly_gloss_statistics }|..|| users : weekly_gloss_statistics_user_id_fkey
  weekly_gloss_statistics }|..|| book : weekly_gloss_statistics_book_id_fkey
  weekly_gloss_statistics }|..|| language : weekly_gloss_statistics_language_id_fkey

Loading

Cron Jobs (pg_cron)

erDiagram
  job{
    ~bigint~ jobid
    ~text~ schedule
    ~text~ command
    ~text~ nodename
    ~integer~ nodeport
    ~text~ database
    ~text~ username
    ~boolean~ active
    ~text~ jobname
  }

  job_run_details{
    ~bigint~ jobid
    ~bigint~ runid
    ~integer~ job_pid
    ~text~ database
    ~text~ username
    ~text~ command
    ~text~ status
    ~text~ return_message
    ~timestamp with time zone~ start_time
    ~timestamp with time zone~ end_time
  }
Loading
Clone this wiki locally