hyunolike / be1-onboarding-survey

이너써클 BE 온보딩 프로젝트 (장현호)
0 stars 0 forks source link

ERD #6

Open hyunolike opened 1 month ago

hyunolike commented 1 month ago

요구사항에 맞춰 ERD 작성

hyunolike commented 1 month ago
image

h2 준비 완료

hyunolike commented 1 month ago

1차 ERD

erDiagram
    Survey {
        int survey_id PK
        string name
        string description
    }

    Question {
        int question_id PK
        int survey_id FK
        string name
        string description
        string input_type
        boolean is_required
    }

    Option {
        int option_id PK
        int question_id FK
        string value
    }

    Response {
        int response_id PK
        int survey_id FK
        date response_date
    }

    ResponseDetail {
        int response_detail_id PK
        int response_id FK
        int question_id FK
        string value
    }

    Survey ||--o{ Question: "has"
    Question ||--o{ Option: "has"
    Survey ||--o{ Response: "has"
    Response ||--o{ ResponseDetail: "has"
    Question ||--o{ ResponseDetail: "applies to"
hyunolike commented 1 month ago

2차 ERD

erDiagram
    FORMS ||--o{ QUESTIONS : contains
    FORMS {
        int id PK
        varchar(255) title
        text description
        datetime created_at
        datetime updated_at
        boolean is_active
    }
    QUESTIONS ||--o{ RESPONSES : has
    QUESTIONS {
        int id PK
        int form_id FK
        int question_type_id FK
        varchar(255) question_text
        int order
        boolean is_required
        text additional_config
    }
    QUESTION_TYPES ||--o{ QUESTIONS : defines
    QUESTION_TYPES {
        int id PK
        varchar(50) type_name
        text config_schema
    }
    RESPONSES {
        int id PK
        int question_id FK
        int submission_id FK
        text response_data
    }
    SUBMISSIONS ||--o{ RESPONSES : contains
    SUBMISSIONS {
        int id PK
        int form_id FK
        datetime submitted_at
        varchar(255) respondent_info
    }
    QUESTION_OPTIONS }o--|| QUESTIONS : has
    QUESTION_OPTIONS {
        int id PK
        int question_id FK
        varchar(255) option_text
        int order
    }