docs(trellis): update for cloud supabase migration

This commit is contained in:
qzl
2026-04-27 10:04:29 +08:00
parent 5325793203
commit 926929a3cb
2 changed files with 47 additions and 2 deletions
+19 -2
View File
@@ -9,10 +9,25 @@
This project uses: This project uses:
- **SQLAlchemy 2.0** with async support (`asyncpg` driver) - **SQLAlchemy 2.0** with async support (`asyncpg` driver)
- **Alembic** for schema migrations - **Alembic** for schema migrations
- **Supabase Auth** as identity source - **Supabase Cloud** for Auth, Database, and Storage
- **PostgreSQL** as primary database - **PostgreSQL** as primary database (via Supabase connection pooler)
- **Soft delete** pattern with `deleted_at` column - **Soft delete** pattern with `deleted_at` column
### Cloud Supabase Connection
The project uses **Supabase Cloud** with connection pooling:
```bash
# .env configuration
ERYAO_DATABASE__HOST=aws-1-us-east-2.pooler.supabase.com
ERYAO_DATABASE__PORT=5432 # Session pooler (IPv4 compatible)
ERYAO_DATABASE__NAME=postgres
ERYAO_DATABASE__USER=postgres.<project-ref>
ERYAO_DATABASE__PASSWORD=<your-password>
```
**Note:** Direct database connection (port 5432 on `db.<project-ref>.supabase.co`) requires IPv6 and is not suitable for most development environments. Use the connection pooler instead.
--- ---
## Query Patterns ## Query Patterns
@@ -133,6 +148,8 @@ def downgrade() -> None:
./infra/scripts/dev-migrate.sh bootstrap ./infra/scripts/dev-migrate.sh bootstrap
``` ```
**Note:** Cloud Supabase migrations may be slower than local due to network latency. Use appropriate timeouts for migration scripts.
**Alembic is the ONLY source of truth for schema changes.** **Alembic is the ONLY source of truth for schema changes.**
--- ---
+28
View File
@@ -101,6 +101,34 @@ cat .trellis/spec/backend/logging-guidelines.md # For logging
4. **Record Promptly** - Update tracking files immediately after completion 4. **Record Promptly** - Update tracking files immediately after completion
5. **Document Limits** - [!] **Max 2000 lines per journal document** 5. **Document Limits** - [!] **Max 2000 lines per journal document**
### Development Environment
**Cloud Supabase Setup:**
1. Configure `.env` with Supabase Cloud credentials:
```bash
ERYAO_SUPABASE__PUBLIC_URL=https://<project-ref>.supabase.co
ERYAO_DATABASE__HOST=aws-1-us-east-2.pooler.supabase.com
ERYAO_DATABASE__PORT=5432 # Session pooler
```
2. Start Redis (required for backend):
```bash
cd infra/docker && docker compose up -d redis
```
3. Run database migrations:
```bash
./infra/scripts/dev-migrate.sh bootstrap
```
4. Start backend server:
```bash
./infra/scripts/app.sh start
```
**Note:** Local Supabase is no longer used. All development uses Supabase Cloud.
### File System ### File System
``` ```