mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 20:52:09 +01:00
- Set up pre-commit hooks with husky and lint-staged for automated code quality - Improved TypeScript type safety by replacing 'any' types with proper generics - Fixed markdown linting violations (MD030 spacing) across all documentation - Fixed compound adjective hyphenation in technical documentation - Fixed invalid JSON union syntax in API documentation examples - Automated code formatting and linting on commit - Enhanced error handling with better type constraints - Configured biome and markdownlint for consistent code style - All changes verified with successful production build
Migration Scripts for tRPC and Batch API Integration
This directory contains comprehensive migration scripts for deploying the new architecture that includes tRPC implementation and OpenAI Batch API integration.
Migration Components
1. Database Migrations
01-schema-migrations.sql- Prisma database schema migrations02-data-migrations.sql- Data transformation scriptsvalidate-database.ts- Database validation and health checks
2. Environment Configuration
environment-migration.ts- Environment variable migration guideconfig-validator.ts- Configuration validation scripts
3. Deployment Scripts
deploy.ts- Main deployment orchestratorpre-deployment-checks.ts- Pre-deployment validationpost-deployment-validation.ts- Post-deployment verificationrollback.ts- Rollback procedures
4. Health Checks
health-checks.ts- Comprehensive system health validationtrpc-endpoint-tests.ts- tRPC endpoint validationbatch-processing-tests.ts- Batch processing system tests
5. Migration Utilities
backup-database.ts- Database backup proceduresrestore-database.ts- Database restore proceduresmigration-logger.ts- Migration logging utilities
Usage
Pre-Migration
- Run database backup:
pnpm migration:backup - Validate environment:
pnpm migration:validate-env - Run pre-deployment checks:
pnpm migration:pre-check
Migration
- Run schema migrations:
pnpm migration:schema - Run data migrations:
pnpm migration:data - Deploy application:
pnpm migration:deploy
Post-Migration
- Validate deployment:
pnpm migration:validate - Run health checks:
pnpm migration:health-check - Test critical paths:
pnpm migration:test
Rollback (if needed)
- Rollback deployment:
pnpm migration:rollback - Restore database:
pnpm migration:restore
Environment Variables
The migration requires these new environment variables:
# tRPC Configuration
TRPC_ENDPOINT_URL=http://localhost:3000/api/trpc
TRPC_BATCH_TIMEOUT=30000
# Batch Processing Configuration
BATCH_PROCESSING_ENABLED=true
BATCH_CREATE_INTERVAL="*/5 * * * *"
BATCH_STATUS_CHECK_INTERVAL="*/2 * * * *"
BATCH_RESULT_PROCESSING_INTERVAL="*/1 * * * *"
BATCH_MAX_REQUESTS=1000
BATCH_TIMEOUT_HOURS=24
# Migration Specific
MIGRATION_MODE=production
MIGRATION_BACKUP_ENABLED=true
MIGRATION_ROLLBACK_ENABLED=true
Zero-Downtime Deployment Strategy
The migration implements a blue-green deployment strategy:
- Phase 1: Deploy new code with feature flags disabled
- Phase 2: Run database migrations
- Phase 3: Enable tRPC endpoints progressively
- Phase 4: Enable batch processing system
- Phase 5: Full activation and old system decommission
Safety Features
- Automatic database backups before migration
- Rollback scripts for quick recovery
- Health checks at each stage
- Progressive feature enablement
- Comprehensive logging and monitoring
- Backwards compatibility maintained during migration