Files
orangecat/scripts
Georgy ButaevandClaude Opus 4.8 f378da533d fix(db): reconcile transactions table with entity schema + add transfer RPC
The live `transactions` table was the dead legacy funding-page schema
(funding_page_id/transaction_hash NOT NULL, 0 rows, target funding_pages
table gone), but all current code speaks an entity schema no migration
defined — so wallet transfers and project contributions 400'd silently,
and the transfer_between_wallets RPC the transfer path calls didn't exist.

Safe rebuild (0 rows, no inbound FKs):
- recreate transactions with the entity schema both writers agree on
  (/api/transactions + domain/wallets/transferService) — verified both
  payloads insert cleanly
- RLS: sender must be auth.uid() (profile) or a project wallet they own;
  verified real user passes, spoofed sender blocked
- add transfer_between_wallets(uuid,uuid,numeric,uuid): atomic, row-locked,
  re-checks balance — verified happy-path moves funds + overdraw raises

Applied to the self-host box; schema-drift audit now green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 13:11:29 +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