♻️ refactor: eliminate database schema redundancy + add comprehensive documentation
Refactor database to migration-only approach and add complete documentation ### Database Architecture Improvements: - **Remove redundant schema files**: Eliminated duplicate table/index definitions - **Single source of truth**: Migration files now exclusively define database schema - **Simplified maintenance**: No more sync issues between schema files and migrations ### Files Removed: - `database/schema/tables.ts` - Redundant table definitions - `database/schema/indexes.ts` - Redundant index definitions ### Files Updated: - `database/schema/index.ts` - Now only exports migration utilities - `database/index.ts` - Simplified exports, removed redundant schema references - `BaseService.ts` - Updated documentation for migration-only approach - `migrator.ts` - Enhanced documentation and clarity ### Documentation Added: - **`database/README.md`** - Comprehensive 400+ line guide covering: - Architecture overview and migration-only approach - Complete directory structure explanation - Migration system lifecycle with diagrams - Query organization and API reference - Development workflow and best practices - Troubleshooting guide and examples ### Benefits: - ✅ Eliminated redundancy between schema and migration files - ✅ Reduced maintenance overhead and potential sync issues - ✅ Established single source of truth for database schema - ✅ Added comprehensive documentation for team development - ✅ Maintained full backward compatibility - ✅ All tests continue to pass (1420/1420) The database system now follows industry best practices with migrations as the sole schema definition method, while providing complete documentation for developers.
This commit is contained in:
@@ -10,7 +10,11 @@ const logger = loggerService.withContext('BaseService')
|
||||
|
||||
/**
|
||||
* Base service class providing shared database connection and utilities
|
||||
* for all agent-related services
|
||||
* for all agent-related services.
|
||||
*
|
||||
* Uses a migration-only approach for database schema management.
|
||||
* The database schema is defined and maintained exclusively through
|
||||
* migration files, ensuring a single source of truth.
|
||||
*/
|
||||
export abstract class BaseService {
|
||||
protected static db: Client | null = null
|
||||
|
||||
Reference in New Issue
Block a user