Files
motovaultpro/docs/redesign/PHASE-07-DATABASE-UPDATES.md
Eric Gullickson 046c66fc7d Redesign
2025-11-01 21:27:42 -05:00

1.5 KiB

Phase 7: Database Updates

Agent Assignment

Primary Agent: infra-agent Duration: 15 minutes

Prerequisites

  • Phase 5 (Network Simplification) must be complete

Objectives

  1. Verify database schema has no tenant_id columns
  2. Ensure all tables use user_id isolation only
  3. Verify migrations don't reference tenants

Step-by-Step Instructions

Step 1: Connect to Database

docker compose exec mvp-postgres psql -U postgres -d motovaultpro

Step 2: Verify No tenant_id Columns

SELECT table_name, column_name
FROM information_schema.columns
WHERE table_schema = 'public'
  AND column_name = 'tenant_id';

Expected: 0 rows

Step 3: Verify user_id Columns Exist

SELECT table_name
FROM information_schema.columns
WHERE table_schema = 'public'
  AND column_name = 'user_id';

Expected: vehicles, fuel_logs, maintenance_logs, documents, etc.

Step 4: Check Migrations

grep -r "tenant" backend/src/_system/migrations/
# Expected: 0 results (no tenant references)

Step 5: Verify Platform Schema (if needed)

If mvp-platform uses separate schema:

CREATE SCHEMA IF NOT EXISTS vehicles_platform;
-- Platform service will initialize its tables

Validation Criteria

  • No tenant_id columns in application database
  • All tables have user_id for isolation
  • Migrations have no tenant references
  • Database accessible from mvp-backend and mvp-platform

Update EXECUTION-STATE.json

{
  "phases": {"7": {"status": "completed", "validation_passed": true}}
}