Skip to content

Polls Models ER Diagram

erDiagram

    User {
        int id PK
        string email
        string phone
        boolean has_initial_profile
        string photo
        text address
        int gender_id FK
        int country_id FK
        date birthday
        datetime created_at
        datetime updated_at
    }

    Product {
        int id PK
        string name
        string description
        decimal price
        datetime created_at
        datetime updated_at
    }

    Question {
        int id PK
        int product_id FK
        int user_id FK
        text question
        datetime created_at
        datetime updated_at
    }

    Answer {
        int id
        int question_id FK
        int user_id FK
        text answer
        datetime created_at
        datetime updated_at
        int vote_count
    }

    Vote {
        int id
        int answer_id FK
        int user_id FK
        int value
        datetime created_at
        datetime updated_at
    }

    User ||--o{ Question : "asks"
    User ||--o{ Answer : "provides"
    User ||--o{ Vote : "casts"
    Product ||--o{ Question : "is related to"
    Question ||--o{ Answer : "receives"
    Answer ||--o{ Vote : "is voted by"