feat: enhance roadmap with detailed tasks and acceptance criteria; update database documentation and query management
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# 0001 Initial Schema
|
||||
|
||||
SQL file: `supabase/schema.sql`
|
||||
|
||||
## Purpose
|
||||
|
||||
This is the first registered database query file for the project. It represents the schema that existed before the Freelancer OS MVP planning work started.
|
||||
|
||||
## What It Creates
|
||||
|
||||
- `journals`
|
||||
- `tasks`
|
||||
- `chat_sessions`
|
||||
- `chat_messages`
|
||||
- `profiles`
|
||||
- Row Level Security policies for the tables above
|
||||
- `handle_new_user()` trigger function for profile creation
|
||||
- `on_auth_user_created` trigger
|
||||
- `avatars` storage bucket and related storage policies
|
||||
|
||||
## Current Product Fit
|
||||
|
||||
This schema supports the earlier MindSpace/Cognis prototype:
|
||||
|
||||
- mood/energy journals
|
||||
- basic tasks
|
||||
- chat history
|
||||
- user profile storage
|
||||
- avatar uploads
|
||||
|
||||
It does not yet fully match the Freelancer OS MVP model.
|
||||
|
||||
## Known Gaps For MVP
|
||||
|
||||
The Freelancer OS MVP still needs new schema additions for:
|
||||
|
||||
- `clients`
|
||||
- `projects`
|
||||
- `calendar_events`
|
||||
- `finance_transactions`
|
||||
- `daily_logs`
|
||||
- `app_settings`
|
||||
|
||||
The existing `journals` table can either be migrated into `daily_logs` or kept as a legacy table until the UI is moved to the new model.
|
||||
|
||||
## Execution Notes
|
||||
|
||||
This file should be treated as the first baseline. If it has already been run in a Supabase project, do not rerun it blindly because some `create table` and `create policy` statements are not idempotent.
|
||||
|
||||
Future changes should be added as ordered migration files rather than editing this baseline after execution.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Database Change Process
|
||||
|
||||
This directory records every database change that should be run against Supabase/PostgreSQL.
|
||||
|
||||
The project currently starts with `supabase/schema.sql` as the first database query file. Future database changes must be added as separate SQL files and registered here before they are run.
|
||||
|
||||
## Rules
|
||||
|
||||
1. Every SQL change must have a stable order number.
|
||||
2. Every SQL file must be listed in `query-order.md`.
|
||||
3. Every executed query must be recorded in `query-log.md`.
|
||||
4. Every meaningful schema addition must have a short documentation file under this directory.
|
||||
5. Do not edit an already executed SQL file silently. Add a new ordered SQL file instead.
|
||||
|
||||
## Current Files
|
||||
|
||||
- `supabase/schema.sql`: Initial legacy schema. It creates the current auth/profile, journal, task, chat, and avatar storage structure.
|
||||
- `docs/database/0001-initial-schema.md`: Explanation for the initial schema.
|
||||
- `docs/database/query-order.md`: Canonical order of SQL files.
|
||||
- `docs/database/query-log.md`: Manual execution log for SQL files that were run against an environment.
|
||||
|
||||
## Next Migration Naming
|
||||
|
||||
Use this pattern for future SQL files:
|
||||
|
||||
```text
|
||||
supabase/migrations/0002_short_description.sql
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```text
|
||||
supabase/migrations/0002_add_freelancer_os_core_tables.sql
|
||||
```
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Database Query Log
|
||||
|
||||
This file records SQL files that were executed against a database environment.
|
||||
|
||||
Do not mark a query as executed unless it was actually run.
|
||||
|
||||
| Date | Environment | Order | SQL file | Runner | Result | Notes |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| Not recorded | Unknown existing environment | 0001 | `supabase/schema.sql` | Unknown | Assumed existing baseline | File existed before this query log was introduced. Confirm manually before rerunning. |
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Database Query Order
|
||||
|
||||
This file is the canonical order of SQL files for database setup and migration.
|
||||
|
||||
| Order | SQL file | Documentation | Status |
|
||||
| --- | --- | --- | --- |
|
||||
| 0001 | `supabase/schema.sql` | `docs/database/0001-initial-schema.md` | Baseline registered |
|
||||
|
||||
## How To Add The Next Query
|
||||
|
||||
1. Create a new SQL file under `supabase/migrations/`.
|
||||
2. Use the next order number.
|
||||
3. Add a documentation file under `docs/database/`.
|
||||
4. Register both files in this table.
|
||||
5. After running the SQL, add an entry to `query-log.md`.
|
||||
|
||||
Reference in New Issue
Block a user