Update: Rewrite of DBI Schema Manager
Problem Statement
The current Hazaar DBI schema management tools (including migrate, replay, rollback, snapshot, and data sync) are outdated and were designed with older PHP practices. Since their development, PHP has introduced new features, such as Enums, that can streamline functionality and improve readability. Additionally, the tools need to align with updated design principles and the new Hazaar\Model
class to better support modern application development.
Who will benefit?
- Developers using Hazaar who need robust and modern tools for database schema and data management.
- Teams seeking more maintainable, readable, and scalable migration and synchronization tools.
- Projects requiring seamless integration between database schema management and updated application models.
Benefits and risks
Benefits
- Leverages modern PHP features like Enums, improving code clarity and reducing errors.
- Aligns schema management tools with updated
Hazaar\Model
class for better consistency. - Provides a more object-oriented approach, improving maintainability and extensibility.
- Enhances developer experience with clearer, more intuitive interfaces for managing migrations and schema changes.
Risks
- Refactoring introduces potential for regressions or incompatibilities with existing migrations.
- Requires a transition period for users currently relying on older tools.
Proposed solution
Rewrite the Hazaar DBI schema management tools with the following improvements:
-
Object-Oriented Design:
- Use a modular, class-based approach to manage schema operations (e.g.,
Migration
,Rollback
,Snapshot
classes). - Implement interfaces for custom extensibility.
- Use a modular, class-based approach to manage schema operations (e.g.,
-
PHP Enums:
- Use Enums to define schema operation types (e.g.,
MigrationType
,OperationStatus
).
- Use Enums to define schema operation types (e.g.,
-
Integration with
Hazaar\Model
:- Ensure schema tools can directly interact with the updated
Hazaar\Model
class for automatic schema updates and validation.
- Ensure schema tools can directly interact with the updated
-
Improved Developer Experience:
- Provide intuitive CLI commands for common operations.
- Support for rollback chains, migration replay, and automated data synchronization with clear feedback.
Priority/Severity
-
High (This will bring a huge increase in performance/productivity/usability/legislative cover) -
Medium (This will bring a good increase in performance/productivity/usability) -
Low (anything else e.g., trivial, minor improvements)