Skip to content

[BE] ERD

MODI edited this page Oct 11, 2023 · 9 revisions
image

issue 75
issue 328
issue 387

// Use DBML to define your database structure
// Docs: https://dbml.dbdiagram.io/docs

Table study {
  id bigint [primary key]
  name varchar(255)
  total_cycle int
  time_per_cycle int
  current_cycle int
  step enum
  created_date datetime(6)
  last_modified_date datetime(6)
}

Table participant_code {
  id bigint [primary key]
  code varchar(255)
  study_id bigint
  created_date datetime(6)
  last_modified_date datetime(6)
}

Table content {
  id bigint [primary key]
  participant_id bigint
  cycle int
  plan text
  retrospect text
  created_date datetime(6)
  last_modified_date datetime(6)
}

Table member {
  id bigint [primary key]
  name varchar(255)
  email varchar(255)
  image_url varchar(255)
  login_type enum('GUEST','GOOGLE', 'KAKAO')
  created_date datetime(6)
  last_modified_date datetime(6)
}

Table refresh_token {
  id bigint [primary key]
  member_id bigint
  UUID binary(16)
  expire_date datetime(6)
  created_date datetime(6)
  last_modified_date datetime(6)
}

Table participant {
  id bigint [primary key]
  study_id bigint
  member_id bigint
  nickname varchar(255)
  is_host tinyint(1)
  created_date datetime(6)
  last_modified_date datetime(6)
}

Ref FK_PARTICIPANT_CODE_STUDY: participant_code.study_id - study.id
Ref FK_PARTICIPANT_STUDY: participant.study_id > study.id
Ref FK_PARTICIPANT_MEMBER: participant.member_id > member.id
Ref FK_CONTENT_PARTICIPANT: participant.id < content.participant_id
Ref FK_REFRESH_TOKEN_MEMBER: member.id - refresh_token.member_id
Clone this wiki locally