1.5 KiB
1.5 KiB
Supabase Directory
This directory stores SQL files for the project's Supabase/PostgreSQL database.
Current Baseline
schema.sqlis the first registered database SQL file.- Its documentation is in
docs/database/0001-initial-schema.md. - Its order is tracked in
docs/database/query-order.md. - Execution history is tracked in
docs/database/query-log.md.
Future Changes
Future schema changes should be added under:
supabase/migrations/
Optional local/demo data should be added under:
supabase/seeds/
Do not overwrite already executed SQL without also creating a new ordered migration and documenting why.
Current Ordered SQL
schema.sqlmigrations/0002_add_freelancer_os_core_tables.sqlmigrations/0003_add_project_planning_assets.sqlmigrations/0004_add_business_os_tables.sqlmigrations/0005_add_advanced_crm_tables.sqlmigrations/0006_add_pgvector_and_embeddings.sqlmigrations/0007_add_client_portal_tables.sqlmigrations/0008_add_project_progress_and_quota.sqlmigrations/0009_lock_registration_after_first_admin.sql- Optional local/demo data:
seeds/0001_demo_freelancer_os_data.sql
Apply Migrations
From the repository root:
DATABASE_URL='postgresql://postgres:password@host:5432/postgres' bash ./scripts/apply-migrations.sh
The script applies all required schema files in canonical order. It requires either local psql or Docker. If psql is not installed, it runs psql through the postgres:16-alpine Docker image.