Design or update the Mind Compass MVP database schema, ERD, and PostgreSQL SQL draft. Use this when defining tables, relationships, constraints, and teaching why each table exists and which APIs depend on it.
This skill is for the mind-compass backend schema design workflow.
Use this skill when the task involves:
Do not use this skill for:
The repository uses a 2-server architecture, but the primary business data lives in Spring Boot persistence.
Main schema areas:
user_idFor each schema task, produce:
For each table, explain:
usersuser_settingsrefresh_tokensdiariesdiary_emotionsdiary_ai_analyseschat_sessionschat_messagesai_response_logssafety_eventsmonthly_reportsusers owns most user-facing recordsdiaries may feed chat_sessionschat_sessions contain many chat_messagesdiaries may have one AI analysis and many emotion tagssafety_events may be linked to a diary or chat sessionmonthly_reports summarize user recordsJSONB only for flexible AI payloads or report payloads# <Schema Task Name>
## 1. Goal
## 2. Design principles
## 3. Table list
## 4. Relationship summary
## 5. Table explanations
## 6. SQL draft
## 7. Index / constraint notes
## 8. Implementation priority
## 9. Next step
diary_ai_analyses should be separate from diaries