|
|
|
Diagrama do BD
|
|
|
|
|
|
|
|
# Visão Geral
|
|
|
|
Este repositório documenta a estrutura relacional do banco de dados do projeto, incluindo tabelas, atributos e relacionamentos. A seguir está uma imagem ilustrativa.
|
|
|
|
# Modelo
|
|
|
|

|
|
|
|
O diagrama pode ser visualizado em: https://dbdiagram.io/d/mapadigital-69cc402378c6c4bc7ab3eea2
|
|
|
|
|
|
|
|
# Documentação das Tabelas
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## user_profile
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | UUID (PK) | Identificador único do usuário |
|
|
|
|
| email | Varchar | E-mail único do usuário |
|
|
|
|
| first_name | Varchar | Primeiro nome |
|
|
|
|
| last_name | Varchar | Sobrenome |
|
|
|
|
| password | Varchar | Senha de acesso |
|
|
|
|
| phone_number | Varchar | Telefone opcional |
|
|
|
|
| is_active | Boolean | Indica se o usuário está ativo |
|
|
|
|
| created_at | Datetime | Data de criação |
|
|
|
|
| deactivated_at | Datetime | Data de desativação lógica |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## admin_profile
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| user_id | UUID (PK/FK) | Referência para user_profile |
|
|
|
|
| subject_area | Integer (FK) | Matéria vinculada ao administrador |
|
|
|
|
| is_superadmin | Boolean | Define permissão máxima |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## student_profile
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| user_id | UUID (PK/FK) | Referência para user_profile |
|
|
|
|
| birth_date | Date | Data de nascimento |
|
|
|
|
| class | Enum | Ano escolar |
|
|
|
|
| school_id | UUID (FK) | Escola vinculada |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## company_profile
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| user_id | UUID (PK/FK) | Referência para user_profile |
|
|
|
|
| spots | Integer | Total de vagas |
|
|
|
|
| available_spots | Integer | Vagas disponíveis |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## school_profile
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| user_id | UUID (PK/FK) | Referência para user_profile |
|
|
|
|
| is_private | Boolean | Define se a escola é privada |
|
|
|
|
| requested_spots | Integer | Vagas solicitadas |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## guardian_profile
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| user_id | UUID (PK/FK) | Referência para user_profile |
|
|
|
|
| guardian_status | Enum | Status do responsável |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## school_company_partnership
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| school_id | UUID (PK/FK) | Escola vinculada |
|
|
|
|
| company_id | UUID (PK/FK) | Empresa vinculada |
|
|
|
|
| is_active | Boolean | Status da parceria |
|
|
|
|
| created_at | Datetime | Data da criação |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## student_guardian
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| student_id | UUID (PK/FK) | Aluno vinculado |
|
|
|
|
| guardian_id | UUID (PK/FK) | Responsável vinculado |
|
|
|
|
| created_at | Datetime | Data da criação |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## subjects
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador da matéria |
|
|
|
|
| name | Varchar | Nome da matéria |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## contents
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador do conteúdo |
|
|
|
|
| subject_id | Integer (FK) | Matéria relacionada |
|
|
|
|
| name | Varchar | Nome do conteúdo |
|
|
|
|
| description | Text | Descrição |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## resources
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| contents_id | Integer (FK) | Conteúdo relacionado |
|
|
|
|
| type | Varchar | Tipo do recurso |
|
|
|
|
| title | Varchar | Título |
|
|
|
|
| url_or_contents | Text | Link ou conteúdo |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## exercises
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| contents_id | Integer (FK) | Conteúdo relacionado |
|
|
|
|
| statement | Text | Enunciado |
|
|
|
|
| difficulty | Enum | Dificuldade |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## options
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| exercise_id | Integer (FK) | Exercício relacionado |
|
|
|
|
| text | Text | Texto da alternativa |
|
|
|
|
| correct | Boolean | Define se está correta |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## attempts
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| student_id | UUID (FK) | Aluno |
|
|
|
|
| exercise_id | Integer (FK) | Exercício |
|
|
|
|
| is_correct | Boolean | Resultado |
|
|
|
|
| time_spent_seconds | Integer | Tempo gasto |
|
|
|
|
| created_at | Timestamp | Data da tentativa |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## paths
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| contents_id | Integer (FK) | Conteúdo relacionado |
|
|
|
|
| name | Varchar | Nome da path |
|
|
|
|
| description | Text | Descrição |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## sub_paths
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| path_id | Integer (FK) | Path relacionada |
|
|
|
|
| difficulty | Enum | Dificuldade |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## sub_paths_item
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| sub_path_id | Integer (FK) | Subpath relacionada |
|
|
|
|
| type_item | Enum | Tipo do item |
|
|
|
|
| item_id | Integer | ID do recurso ou exercício |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## path_transition
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| sub_path_origem_id | Integer (FK) | Origem |
|
|
|
|
| sub_path_destino_id | Integer (FK) | Destino |
|
|
|
|
| rule_type | Enum | Tipo da regra |
|
|
|
|
| rule_value | Integer | Valor da regra |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## student_path_progress
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| student_id | UUID (FK) | Aluno |
|
|
|
|
| path_id | Integer (FK) | Path |
|
|
|
|
| current_sub_path | Integer (FK) | Subpath atual |
|
|
|
|
| path_status | Enum | Status |
|
|
|
|
| updated_at | Timestamp | Última atualização |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## well_being
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| student_id | UUID (PK/FK) | Aluno |
|
|
|
|
| date | Date (PK) | Data do registro |
|
|
|
|
| humor | Enum | Humor do dia |
|
|
|
|
| online_activity_minutes | Integer | Tempo online |
|
|
|
|
| sleep_hours | Decimal | Horas de sono |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## tasks
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| student_id | UUID (FK) | Aluno |
|
|
|
|
| description | Varchar | Descrição |
|
|
|
|
| task_status | Enum | Status |
|
|
|
|
| date | Timestamp | Data |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## student_content_progress
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| student_id | UUID (FK) | Aluno |
|
|
|
|
| content_id | Integer (FK) | Conteúdo |
|
|
|
|
| mastery_level | Decimal | Nível de domínio |
|
|
|
|
| created_at | Timestamp | Data de criação |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## login_history
|
|
|
|
|
|
|
|
| Campo | Tipo | Descrição |
|
|
|
|
|---|---|---|
|
|
|
|
| id | Integer (PK) | Identificador |
|
|
|
|
| user_id | UUID (FK) | Usuário |
|
|
|
|
| created_at | Timestamp | Data do login |
|
|
|
|
| ip | Varchar | IP de acesso |
|
|
|
|
| deactivated_at | Datetime | Soft delete |
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Relacionamentos
|
|
|
|
|
|
|
|
# Ferramentas
|
|
|
|
|