Skip to content

Commit 0a6b45d

Browse files
committed
chore: prepare release v2.8.0
- Add comprehensive changelog entry for v2.8.0 (2025-11-01) - Document all new features: ActiveRecord Pattern, Query Performance Profiling, Materialized CTEs, PSR-14 Events - Document exception testing improvements and Infection mutation testing - Update Unreleased link to compare v2.8.0...HEAD - Add release comparison link v2.7.1...v2.8.0
1 parent 90e0498 commit 0a6b45d

File tree

1 file changed

+159
-1
lines changed

1 file changed

+159
-1
lines changed

CHANGELOG.md

Lines changed: 159 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,163 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010

11+
## [2.8.0] - 2025-11-01
12+
13+
### Added
14+
- **ActiveRecord Pattern** - Optional lightweight ORM for object-based database operations:
15+
- **Magic attribute access** - `$user->name`, `$user->email`
16+
- **Automatic CRUD** - `save()`, `delete()`, `refresh()`
17+
- **Dirty tracking** - Track changed attributes automatically
18+
- **Declarative validation** - Rules-based validation with extensible validators (required, email, integer, string, custom)
19+
- **Lifecycle events** - PSR-14 events for save, insert, update, delete operations
20+
- **ActiveQuery builder** - Full QueryBuilder API through `find()` method
21+
- `Model` base class with complete ActiveRecord implementation
22+
- `ValidatorInterface` for custom validation rules
23+
- Comprehensive examples in `examples/23-active-record/`
24+
- Complete documentation in `documentation/05-advanced-features/active-record.md`
25+
- Comprehensive test coverage with edge case testing
26+
27+
- **Query Performance Profiling** - Built-in profiler for performance analysis:
28+
- Automatic tracking of all query executions
29+
- Execution time measurement (total, average, min, max)
30+
- Memory usage tracking per query
31+
- Slow query detection with configurable threshold
32+
- Query grouping by SQL structure (same query pattern grouped together)
33+
- PSR-3 logger integration for slow query logging
34+
- Statistics reset for new measurement periods
35+
- `enableProfiling()`, `disableProfiling()`, `getProfilerStats()`, `getSlowestQueries()` methods
36+
- Complete documentation in `documentation/05-advanced-features/query-profiling.md`
37+
- Examples in `examples/21-query-profiling/`
38+
39+
- **Materialized CTE Support** - Performance optimization for expensive queries:
40+
- `QueryBuilder::withMaterialized()` method for PostgreSQL and MySQL
41+
- PostgreSQL: Uses `MATERIALIZED` keyword
42+
- MySQL: Uses optimizer hints
43+
- Automatically cached expensive CTE computations
44+
- Cross-database support (PostgreSQL 12+, MySQL 8.0+)
45+
- Examples in `examples/17-cte/03-materialized-cte.php`
46+
- Documentation updates in `documentation/03-query-builder/cte.md`
47+
48+
- **PSR-14 Event Dispatcher Integration** - Event-driven architecture:
49+
- `ConnectionOpenedEvent` - Fired when connection is opened
50+
- `QueryExecutedEvent` - Fired after successful query execution
51+
- `QueryErrorEvent` - Fired when query error occurs
52+
- `TransactionStartedEvent`, `TransactionCommittedEvent`, `TransactionRolledBackEvent`
53+
- Works with any PSR-14 compatible event dispatcher (Symfony, League, custom)
54+
- Examples in `examples/19-events/`
55+
- Complete integration guide in documentation
56+
57+
- **Enhanced EXPLAIN with Recommendations** - Automatic query optimization analysis:
58+
- `QueryBuilder::explainAdvice()` method (renamed from `explainWithRecommendations`)
59+
- Automatic detection of full table scans
60+
- Missing index identification with SQL suggestions
61+
- Filesort and temporary table warnings
62+
- Dialect-aware parsing (MySQL, PostgreSQL, SQLite)
63+
- Structured recommendations with severity levels
64+
- Enhanced documentation and examples
65+
66+
- **Comprehensive Exception Testing** - Full test coverage for exception handling:
67+
- `ExceptionTests` - 33 tests covering all exception classes and ExceptionFactory
68+
- `ErrorDetectionStrategyTests` - 36 tests for all error detection strategies
69+
- `ConstraintParserTests` - 14 tests for error message parsing
70+
- `ErrorCodeRegistryTests` - 30 tests for error code registry
71+
- Improved `ConstraintParser` with better pattern matching:
72+
- Enhanced `CONSTRAINT \`name\`` pattern matching for MySQL
73+
- Improved `FOREIGN KEY (\`name\`)` pattern for column extraction
74+
- Better `schema.table` format handling
75+
- Filtering of invalid constraint names (e.g., "fails", "failed")
76+
- All exception classes now fully tested with edge cases
77+
78+
- **Infection Mutation Testing** - Code quality assurance:
79+
- Integrated Infection mutation testing framework
80+
- Configuration file `infection.json` with comprehensive settings
81+
- Mutation testing scripts in `composer.json`:
82+
- `composer infection` - Full mutation test run
83+
- `composer infection:quick` - Quick mutation test
84+
- `composer infection:ci` - CI-optimized mutation test
85+
- `composer check-all-with-infection` script for complete quality checks
86+
- Minimum MSI (Mutation Score Indicator) requirements configured
87+
88+
### Changed
89+
- **External Reference Detection Simplification** - KISS/YAGNI refactoring:
90+
- Removed `externalTables` array and `setExternalTables()` method
91+
- Simplified `isTableInCurrentQuery()` to only check against current query table
92+
- External references automatically detected without manual configuration
93+
- Cleaner, more maintainable code following KISS principles
94+
95+
- **Query Compilation Cache Improvements**:
96+
- Fixed compilation cache normalization issues
97+
- Prevented double caching in `getValue()` method
98+
- Optimized result cache by avoiding double SQL compilation
99+
- Renamed `21-query-compilation-cache` directory to `20-query-compilation-cache`
100+
- Updated all documentation references
101+
102+
- **Memory Management Enhancements**:
103+
- Fixed memory leaks by properly closing PDOStatement cursors
104+
- All fetch methods (`get()`, `getOne()`, `fetch()`, `fetchColumn()`) automatically close cursors
105+
- Exception-safe cleanup using `try/finally` blocks
106+
- Production-tested with 50,000+ queries without memory accumulation
107+
- Added memory leak prevention documentation to README
108+
109+
- **Method Renaming for Clarity**:
110+
- `QueryBuilder::cursor()` renamed to `QueryBuilder::stream()` for better API clarity
111+
- `QueryBuilder::explainWithRecommendations()` renamed to `QueryBuilder::explainAdvice()`
112+
- Updated all documentation and examples
113+
114+
- **Test Organization Improvements**:
115+
- Split tests into organized groups for better CI workflow
116+
- Improved PHPUnit configuration for directory-based test execution
117+
- Better test isolation and structure
118+
119+
### Fixed
120+
- **SQLite Cache Parameter Validation** - Prevent invalid DSN parameters:
121+
- Added validation for SQLite `cache` parameter in `SqliteDialect::buildDsn()`
122+
- Valid values: `shared`, `private`
123+
- Throws `InvalidArgumentException` for invalid values
124+
- Prevents creation of files like `:memory:;cache=Array` or `:memory:;cache=invalid`
125+
- Added comprehensive tests for cache and mode parameter validation
126+
127+
- **SQL Identifier Quoting in FileLoader** - Correct quoting for different dialects:
128+
- Fixed SQL identifier quoting in `FileLoader` for MySQL, PostgreSQL, and SQLite
129+
- Ensures proper quoting based on dialect-specific requirements
130+
- Improved cross-dialect compatibility
131+
132+
- **LATERAL JOIN Improvements**:
133+
- Enhanced automatic external reference detection in LATERAL JOIN subqueries
134+
- Removed need for `Db::raw()` in most LATERAL JOIN scenarios
135+
- Better alias handling and SQL generation
136+
- Updated all examples and documentation
137+
138+
- **Removed All Skipped Tests** - Zero skipped tests policy:
139+
- Moved all dialect-specific tests from shared to dialect-specific test files
140+
- No more `markTestSkipped()` calls in shared tests
141+
- All tests actively run and verify functionality
142+
143+
- **Markdown EOF Formatting** - Consistent file formatting:
144+
- Added `fix-markdown-eof.sh` script to ensure exactly one empty line at EOF
145+
- Integrated into `composer check-all` for automatic fixing
146+
- All markdown files now have consistent formatting
147+
148+
### Technical Details
149+
- **All tests passing**: 991 tests, 3951 assertions (+417 tests, +1425 assertions from 2.7.1)
150+
- **All examples passing**: 147/147 examples (49 files × 3 dialects each)
151+
- SQLite: 49/49 ✅
152+
- MySQL: 49/49 ✅
153+
- PostgreSQL: 49/49 ✅
154+
- **PHPStan Level 8**: Zero errors across entire codebase
155+
- **PHP-CS-Fixer**: All code complies with PSR-12 standards
156+
- **Full backward compatibility**: 100% maintained - all existing code continues to work
157+
- **Code quality**: Follows KISS, SOLID, DRY, YAGNI principles
158+
- **Memory safety**: Zero memory leaks verified with 50,000+ query tests
159+
- **SHA-256 hashing**: Replaced all MD5 usage with SHA-256 for better security:
160+
- Cache key generation uses SHA-256
161+
- Parameter name generation uses SHA-256 with 16-character truncation
162+
- LATERAL JOIN alias generation uses SHA-256
163+
- **Infection mutation testing**: Integrated for code quality assurance
164+
- **Code statistics**: Significant additions across exception handling, ActiveRecord, and profiling features
165+
166+
---
167+
11168
## [2.7.1] - 2025-10-29
12169

13170
### Added
@@ -818,7 +975,8 @@ Initial tagged release with basic PDO database abstraction functionality.
818975

819976
---
820977

821-
[Unreleased]: https://github.com/tommyknocker/pdo-database-class/compare/v2.7.1...HEAD
978+
[Unreleased]: https://github.com/tommyknocker/pdo-database-class/compare/v2.8.0...HEAD
979+
[2.8.0]: https://github.com/tommyknocker/pdo-database-class/compare/v2.7.1...v2.8.0
822980
[2.7.1]: https://github.com/tommyknocker/pdo-database-class/compare/v2.7.0...v2.7.1
823981
[2.7.0]: https://github.com/tommyknocker/pdo-database-class/compare/v2.6.2...v2.7.0
824982
[2.6.2]: https://github.com/tommyknocker/pdo-database-class/compare/v2.6.1...v2.6.2

0 commit comments

Comments
 (0)