Files
orangecat/scripts
Georgy ButaevandClaude Opus 4.8 a0eeada3ad fix(audit): extend schema-drift tool to insert/update payloads; fix group activity logging
The schema-drift auditor only checked .select()/filter columns, which is why the
is_test INSERT bug slipped through. Extended it to also validate the top-level keys
of .insert()/.update()/.upsert() object literals against the live schema (depth-1
only; skips spreads and _synthetic keys). Refreshed scripts/db/live-schema.json
from the box (96 tables).

The extended sweep immediately found two real bugs:
1. group_activities (FIXED here): the logger inserted description + related_* as
   columns, but the table only has `metadata` (jsonb). Every insert failed and the
   catch swallowed it, so the group activity feed never recorded anything. Now folds
   those into metadata.
2. transactions / wallet transfers (DOCUMENTED, not fixed): transferService inserts
   ~12 entity-based columns (from_entity_type, to_entity_type, payment_method, …) but
   the live `transactions` table is the legacy funding-page schema (no such columns),
   and no migration defines the entity schema. So wallet-to-wallet transfers are
   broken. Fixing needs a deliberate transactions-schema reconciliation (other code
   may read the legacy columns) — flagged for a careful follow-up, not a blind ALTER.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 12:35:26 +02:00
..
2025-12-10 16:56:40 +01:00
2025-12-10 16:56:40 +01:00

Scripts Directory

This directory contains all automation scripts organized by purpose.

Directory Structure

  • analysis/ - Bundle analysis, documentation checking, and optimization tools
  • auth-fix/ - Scripts to fix authentication and RLS policy issues
  • db/ - Database operations, migrations, and schema management
    • Migration scripts moved from root: apply-migration.js, apply-*-migration.js
    • Old schema files archived in db/archive/
  • deployment/ - Deployment, production setup, and monitoring scripts
  • dev/ - Development helpers, local setup, and debugging tools
  • diagnostics/ - Health checks and system diagnostics
  • maintenance/ - Cleanup, optimization, and maintenance scripts
  • monitoring/ - Performance monitoring and bundle size tracking
  • oauth/ - OAuth provider setup and configuration
  • profile-fix/ - Scripts to fix profile-related issues
  • schema-fix/ - Database schema fixes and migrations
  • storage/ - Supabase storage bucket setup and management
  • test/ - Testing utilities and validation scripts
    • Test/debug scripts moved from root: test-*.js, check-*.js, debug-*.js

Usage

Most scripts can be run with:

node scripts/{category}/script-name.js

For deployment scripts:

bash scripts/deployment/script-name.sh

Important Scripts

  • scripts/dev/dev-start.js - Main development server starter
  • scripts/deployment/browser-verify.js - Post-deploy browser smoke test (deploys themselves happen on the box — see docs/deployment/DEPLOYMENT_PROCESS.md)
  • scripts/db/apply-migrations.ts - Database migrations
  • scripts/maintenance/cleanup-console-logs.ts - Remove console.log statements