@@ -7,6 +7,133 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ## [ 2.10.2] - 2025-11-18
11+
12+ ### Added
13+ - ** Database Dump and Restore** (` pdodb dump ` ) - Export and import database schema and data:
14+ - ` pdodb dump ` - Dump entire database to SQL
15+ - ` pdodb dump <table> ` - Dump specific table
16+ - ` pdodb dump --schema-only ` - Dump only schema (CREATE TABLE, indexes, etc.)
17+ - ` pdodb dump --data-only ` - Dump only data (INSERT statements)
18+ - ` pdodb dump --output=<file> ` - Write dump to file instead of stdout
19+ - ` pdodb dump --no-drop-tables ` - Exclude DROP TABLE IF EXISTS statements (included by default)
20+ - ` pdodb dump restore <file> ` - Restore database from SQL dump file
21+ - ` pdodb dump restore <file> --force ` - Restore without confirmation
22+ - Cross-dialect support for all database types
23+ - Automatic DROP TABLE IF EXISTS before CREATE TABLE (configurable)
24+
25+ - ** Table Management** (` pdodb table ` ) - Comprehensive table operations:
26+ - ` pdodb table list ` - List all tables
27+ - ` pdodb table info <table> ` - Show detailed table information
28+ - ` pdodb table exists <table> ` - Check if table exists
29+ - ` pdodb table create <table> ` - Create new table with interactive column prompts
30+ - ` pdodb table drop <table> ` - Drop table (with confirmation)
31+ - ` pdodb table rename <table> <new_name> ` - Rename table
32+ - ` pdodb table truncate <table> ` - Truncate table data
33+ - ` pdodb table describe <table> ` - Show table structure
34+ - ` pdodb table columns list <table> ` - List all columns
35+ - ` pdodb table columns add <table> ` - Add new column
36+ - ` pdodb table columns alter <table> <column> ` - Modify column
37+ - ` pdodb table columns drop <table> <column> ` - Drop column
38+ - ` pdodb table indexes list <table> ` - List all indexes
39+ - ` pdodb table indexes add <table> ` - Create new index
40+ - ` pdodb table indexes drop <table> <index> ` - Drop index
41+ - Support for ` --format ` option (table, json, yaml)
42+ - Support for ` --if-exists ` and ` --if-not-exists ` flags
43+
44+ - ** Database Management** (` pdodb db ` ) - Database operations:
45+ - ` pdodb db create <name> ` - Create new database
46+ - ` pdodb db drop <name> ` - Drop database (with confirmation)
47+ - ` pdodb db exists <name> ` - Check if database exists
48+ - ` pdodb db list ` - List all databases
49+ - ` pdodb db info <name> ` - Show database information
50+ - Interactive prompts for database name input
51+ - Database name display in command header
52+
53+ - ** User Management** (` pdodb user ` ) - Database user operations:
54+ - ` pdodb user create <username> ` - Create new database user
55+ - ` pdodb user drop <username> ` - Drop user (with confirmation)
56+ - ` pdodb user exists <username> ` - Check if user exists
57+ - ` pdodb user list ` - List all users
58+ - ` pdodb user info <username> ` - Show user information
59+ - ` pdodb user grant <username> ` - Grant privileges to user
60+ - ` pdodb user revoke <username> ` - Revoke privileges from user
61+ - ` pdodb user password <username> ` - Change user password
62+ - Cross-dialect support (MySQL, MariaDB, PostgreSQL, MSSQL)
63+
64+ - ** Query Command Enhancements** (` pdodb query ` ):
65+ - ` pdodb query explain <sql> ` - Show EXPLAIN plan for query
66+ - ` pdodb query format <sql> ` - Pretty-print and format SQL
67+ - ` pdodb query validate <sql> ` - Validate SQL syntax
68+
69+ - ** Model Generator Enhancements** (` pdodb model ` ):
70+ - ` --force ` option - Overwrite existing models without confirmation
71+ - ` --namespace=<ns> ` option - Specify namespace for generated models
72+ - ` --connection=<name> ` - Select named connection (global option)
73+
74+ - ** Global CLI Options** :
75+ - ` --help ` - Show help message (available globally and per-command)
76+ - ` --connection=<name> ` - Use named connection from config/db.php
77+ - ` --config=<path> ` - Path to db.php configuration file
78+ - ` --env=<path> ` - Path to .env file
79+
80+ - ** Migration Command Enhancements** (` pdodb migrate ` ):
81+ - ` --dry-run ` option - Show SQL without executing
82+ - ` --pretend ` option - Show what would be executed
83+ - ` --force ` option - Skip confirmation prompts
84+ - Confirmation prompts for ` migrate up ` command
85+
86+ ### Changed
87+ - ** SQL Formatter Improvements** :
88+ - Enhanced tokenization with proper whitespace handling
89+ - Multi-word keyword recognition (LEFT/RIGHT/FULL [ OUTER] JOIN, GROUP BY, ORDER BY)
90+ - Consistent keyword uppercasing
91+ - Improved formatting with proper line breaks for major clauses
92+ - Better handling of quoted strings and parentheses
93+
94+ - ** Dialect Architecture Refactoring** :
95+ - Split dialect classes into separate components (SqlFormatter, DmlBuilder, DdlBuilder)
96+ - Reorganized dialects into subdirectories (sqlite/, mysql/, mariadb/, postgresql/, mssql/)
97+ - Extracted FeatureSupport classes for better organization
98+ - Replaced magic strings with QueryConstants class
99+
100+ - ** CLI Command Behavior** :
101+ - Commands now show help when no arguments provided (consistent behavior)
102+ - Improved error messages with helpful suggestions (e.g., typo detection for 'restore')
103+ - Better table existence checking before operations
104+
105+ ### Fixed
106+ - ** Error Handling** :
107+ - Improved error handling in ` pdodb dump ` command (replaces fatal errors with user-friendly messages)
108+ - Typo detection for 'restore' command with helpful suggestions
109+ - Table existence check before dumping (prevents fatal errors)
110+ - Better exception handling with try/catch for QueryException and general Exception
111+
112+ - ** Configuration Loading** :
113+ - Fixed configuration loading order in BaseCliCommand
114+ - Corrected environment variable checks for CI environments
115+ - Improved MSSQL configuration loading (sqlsrv driver alias support)
116+ - Fixed MySQL/MariaDB CI environment variable support in examples
117+
118+ - ** CI/CD** :
119+ - Added CI environment variable support to MariaDB config and workflow
120+ - Fixed MariaDB examples failing in GitHub Actions
121+ - Improved configuration file detection for examples
122+
123+ - ** Window Functions** :
124+ - Restored MariaDB LAG/LEAD default value handling in formatWindowFunction
125+
126+ - ** CLI Tools** :
127+ - Fixed CLI prompts display before waiting for input
128+ - Prevented CLI tools from hanging in tests by adding non-interactive mode
129+ - Improved MySQL/MariaDB table listing robustness
130+
131+ ### Technical Details
132+ - ** All tests passing** : 2390 tests, 8016 assertions across all dialects
133+ - ** Test coverage** : Increased CLI integration test coverage
134+ - ** Code quality** : PHPStan level 8, PHP-CS-Fixer compliant
135+ - ** Full backward compatibility** : 100% maintained
136+
10137## [ 2.10.1] - 2025-11-11
11138
12139### Added
@@ -1462,7 +1589,8 @@ Initial tagged release with basic PDO database abstraction functionality.
14621589
14631590---
14641591
1465- [Unreleased]: https://github.com/tommyknocker/pdo-database-class/compare/v2.10.1...HEAD
1592+ [Unreleased]: https://github.com/tommyknocker/pdo-database-class/compare/v2.10.2...HEAD
1593+ [2.10.2]: https://github.com/tommyknocker/pdo-database-class/compare/v2.10.1...v2.10.2
14661594[2.10.1]: https://github.com/tommyknocker/pdo-database-class/compare/v2.10.0...v2.10.1
14671595[2.10.0]: https://github.com/tommyknocker/pdo-database-class/compare/v2.9.3...v2.10.0
14681596[2.9.3]: https://github.com/tommyknocker/pdo-database-class/compare/v2.9.2...v2.9.3
0 commit comments