Skip to content

Commit 511d14b

Browse files
committed
chore: prepare release v2.12.0
- Update CHANGELOG.md with v2.12.0 release notes (2025-12-12) - Update CLI version to 2.12.0 in Application.php - Add MSSQL system schema filtering for better performance - Update version links in CHANGELOG.md Major features: - Added optimize command (analyze, structure, logs, query) - Added AI-powered database analysis (ai query, schema, optimize) - Support for 6 AI providers (OpenAI, Anthropic, Google, Microsoft, DeepSeek, Yandex) - Performance optimizations (~25% faster schema analysis) - Test reliability improvements
1 parent 55e386e commit 511d14b

File tree

3 files changed

+96
-4
lines changed

3 files changed

+96
-4
lines changed

CHANGELOG.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,82 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.12.0] - 2025-12-12
11+
12+
### Added
13+
- **Optimize Command** (`pdodb optimize`) - Comprehensive database optimization tool:
14+
- `pdodb optimize analyze` - Analyze database schema for optimization opportunities
15+
- `pdodb optimize structure` - Analyze specific table structure
16+
- `pdodb optimize logs` - Analyze slow query logs
17+
- `pdodb optimize query` - Analyze and optimize specific SQL queries
18+
- Detects missing indexes, redundant indexes, missing foreign key indexes
19+
- Suggests indexes for common patterns (soft delete, status columns, timestamps)
20+
- Identifies large tables that may benefit from partitioning
21+
- Provides detailed statistics and recommendations
22+
- Support for JSON, table, and YAML output formats
23+
24+
- **AI-Powered Database Analysis** (`pdodb ai`) - Intelligent database optimization with AI:
25+
- `pdodb ai query <sql>` - Get AI-powered query analysis and optimization suggestions
26+
- `pdodb ai schema [table]` - Analyze database schema with AI recommendations
27+
- `pdodb ai optimize` - AI-powered database optimization suggestions
28+
- Automatic EXPLAIN plan integration for better AI analysis
29+
- Support for multiple AI providers:
30+
- **OpenAI** (GPT-4, GPT-3.5-turbo, GPT-4-turbo)
31+
- **Anthropic** (Claude 3 Opus, Sonnet, Haiku)
32+
- **Google** (Gemini Pro, Gemini Pro Vision)
33+
- **Microsoft Azure OpenAI** (GPT-4, GPT-3.5-turbo)
34+
- **DeepSeek** (DeepSeek Chat, DeepSeek Coder)
35+
- **Yandex Cloud GPT** (YandexGPT, YandexGPT Lite)
36+
- Configurable temperature, max_tokens, and timeout settings
37+
- Progress indicators for long-running AI requests
38+
- Integration with `explainAiAdvice()` method in QueryBuilder
39+
40+
- **AI Provider Configuration**:
41+
- Support for temperature, max_tokens, and timeout configuration for all AI providers
42+
- Improved error handling and response parsing
43+
- Enhanced markdown formatting in AI responses
44+
- AI configuration options in `pdodb init` command
45+
46+
### Changed
47+
- **Performance Optimizations**:
48+
- Optimized `SchemaAnalyzer` to reduce duplicate database queries (~25% faster)
49+
- Eliminated redundant `TableManager::info()` and `getForeignKeys()` calls
50+
- Optimized `getTableRowCount()` to only execute for tables with detected issues
51+
- Removed unnecessary `tableExists()` checks
52+
- Added filtering for Oracle system tables (`BIN$%`, `SYS_%`, `DUAL`)
53+
- Added filtering for MSSQL system schemas (`sys`, `INFORMATION_SCHEMA`)
54+
- Improved test execution time for Oracle optimize tests (32s → 24s)
55+
56+
- **Code Quality**:
57+
- Removed `#[RunInSeparateProcess]` attributes from tests
58+
- Improved test reliability by throwing exceptions instead of `exit()` in test environment
59+
- Better handling of non-interactive mode in CLI commands
60+
- Extracted magic numbers to constants in AI providers
61+
62+
### Fixed
63+
- **Test Reliability**:
64+
- Fixed blocking input issues in non-interactive test environments
65+
- Fixed "risky tests" warnings by properly managing output buffers
66+
- Fixed MSSQL test failures in GitHub Actions (environment variable handling)
67+
- Fixed Oracle test timeouts and hanging issues
68+
- Preserved critical environment variables in test tearDown methods
69+
- Improved non-interactive mode detection across all CLI commands
70+
71+
- **AI Command**:
72+
- Removed redundant `ai analyze` command (consolidated into `ai query`)
73+
- Fixed AI command output formatting
74+
- Fixed schema analysis in AI command
75+
- Improved Yandex AI provider response handling
76+
77+
- **Database Dialect Fixes**:
78+
- Fixed MSSQL `listTables()` to filter system schemas for better performance
79+
- Fixed Oracle system table filtering in `listTables()`
80+
81+
### Documentation
82+
- Updated `composer.json` with AI integration keywords and description
83+
- Removed references to deprecated `ai analyze` command
84+
- Updated bash completion script to remove `ai analyze` command
85+
1086
## [2.11.2] - 2025-12-06
1187

1288
### Added
@@ -1981,7 +2057,8 @@ Initial tagged release with basic PDO database abstraction functionality.
19812057

19822058
---
19832059

1984-
[Unreleased]: https://github.com/tommyknocker/pdo-database-class/compare/v2.11.2...HEAD
2060+
[Unreleased]: https://github.com/tommyknocker/pdo-database-class/compare/v2.12.0...HEAD
2061+
[2.12.0]: https://github.com/tommyknocker/pdo-database-class/compare/v2.11.2...v2.12.0
19852062
[2.11.2]: https://github.com/tommyknocker/pdo-database-class/compare/v2.11.1...v2.11.2
19862063
[2.11.1]: https://github.com/tommyknocker/pdo-database-class/compare/v2.11.0...v2.11.1
19872064
[2.11.0]: https://github.com/tommyknocker/pdo-database-class/compare/v2.10.3...v2.11.0

src/cli/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ protected function detectVersion(): string
267267
}
268268

269269
// Ultimate fallback
270-
return '2.11.1';
270+
return '2.12.0';
271271
}
272272

273273
/**
@@ -277,7 +277,7 @@ protected function detectVersion(): string
277277
*/
278278
public function getVersion(): string
279279
{
280-
return $this->version ?? '2.11.2';
280+
return $this->version ?? '2.12.0';
281281
}
282282

283283
/**

src/dialects/mssql/MSSQLDialect.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,8 +2043,23 @@ public function getSlowQueries(PdoDb $db, float $thresholdSeconds, int $limit):
20432043
*/
20442044
public function listTables(PdoDb $db, ?string $schema = null): array
20452045
{
2046+
// Filter out system schemas for better performance
2047+
// Exclude sys, INFORMATION_SCHEMA, and other system schemas
2048+
$sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
2049+
WHERE TABLE_TYPE='BASE TABLE'
2050+
AND TABLE_SCHEMA NOT IN ('sys', 'INFORMATION_SCHEMA')";
2051+
2052+
if ($schema !== null) {
2053+
$sql .= " AND TABLE_SCHEMA = :schema";
2054+
$params = [':schema' => $schema];
2055+
} else {
2056+
$params = [];
2057+
}
2058+
2059+
$sql .= " ORDER BY TABLE_NAME";
2060+
20462061
/** @var array<int, array<string, mixed>> $rows */
2047-
$rows = $db->rawQuery("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' ORDER BY TABLE_NAME");
2062+
$rows = $db->rawQuery($sql, $params);
20482063
/** @var array<int, string> $names */
20492064
$names = array_map(static fn (array $r): string => (string)$r['TABLE_NAME'], $rows);
20502065
return $names;

0 commit comments

Comments
 (0)