Releases: codemonster-ru/database
Releases · codemonster-ru/database
Release v2.0.0
Added
- Schema:
GrammarResolverandSchema::forConnection()to centralize grammar selection. - QueryBuilder: configurable empty
whereIn/whereNotInbehavior. - Docs/typing: richer PHPDoc generics for ModelQuery/relations and query builder return shapes.
Changed
- QueryBuilder: improved alias handling for
select/value/pluckandtable.*wrapping. - Schema: SQLite migration table DDL now uses SQLite-specific syntax.
Fixed
- SoftDeletes: unsaved models no longer insert on delete.
- ModelQuery: methods that return values now return the builder result (not always
$this). - Schema: unified MySQL grammar to a single canonical class.
Tests
- Expanded coverage across QueryBuilder, Schema/Grammar, migrations, and transactions.
Release v1.6.0
Added
- CLI db:wipe: Drop all tables in the database with confirmation and
--force. - CLI db:truncate: Remove all data except the migrations table, with confirmation and
--force. - CLI tests: Coverage for wipe and truncate commands.
Changed
- CLI output standardized on
echofor stdout; errors remain on stderr.
Release v1.5.0
Added
- Seeders: New seeding system with
Seeder,SeederRunner, andSeedPathResolver. - CLI seed commands:
seedandmake:seedwith configurable default path (./database/seeds). - Seeder tests: Coverage for runner behavior, path resolver, and CLI commands.
- Docs: README updated with seeder usage and configuration examples.
Changed
- CLI seed command output now uses stdout consistently for testability.
Release v1.4.3
Fixed
- Transaction wrapper now checks
inTransaction()before commit/rollback to avoid "no active transaction" errors when drivers auto-commit DDL. $table->id()auto-assigns a primary key only when none exists, keeping AUTO_INCREMENT valid on MySQL.- Column modifiers
->unique()/->primary()are now emitted inline for MySQL/SQLite grammars, so$table->string('email')->unique()creates the constraint.
Release v1.4.2
Changed
- CLI make:migration: Migration names must now be CamelCase Latin words (e.g.,
CreateUsersTable); invalid names are rejected with an error.
Release v1.4.1
Added
- CLI tests: Added coverage for skipping already-ran migrations and for migration path resolver uniqueness/default path handling.
Fixed
- Migrator: Pending detection now compares against ran migration names, preventing repeat execution of logged migrations.
- CLI path resolver: Allows registering default migration path even if the directory does not exist yet and deduplicates entries.
Release v1.4.0
Added
- ORM test coverage: Added PHPUnit tests for Model, ModelQuery, ModelCollection, SoftDeletes, and all relation types; seeded fake profiles/roles for relation scenarios.
- In-memory fakes: FakeConnection now exposes table storage; FakeQueryBuilder emulates where/null filters, pivot joins, pagination counters, and CRUD without PDO.
Fixed
- Eliminated PHPUnit notice in Migrator tests by stubbing
MigrationPathResolver. - Fake query builder signatures now align with
QueryBuilderInterface(return types, count/exists) to avoid compatibility errors during tests.
Release v1.1.0
Added
-
Multi-driver connection support
- Added
driveroption (mysql,sqlite) - Automatic DSN selection based on driver
- SQLite in-memory support (
sqlite::memory:)
- Added
-
Schema Grammars System
- New extensible
Grammararchitecture - Implemented
MySqlGrammar - Implemented
SQLiteGrammar - Added implementations for:
compileCreatecompileDropcompileDropIfExistscompileAltercompileRenameTablecompileColumncompileForeigncompileInlineForeign
- New extensible
-
Improved Blueprint & ColumnDefinition
- Full type map with consistent options (
length,precision,scale) - Unified modifiers:
nullable,default,unsigned,autoIncrement,comment,primary,unique,change
- Full type map with consistent options (
Changed
Connection:- Requires
driverexplicitly - DSN now depends on the selected driver
- Returns a
Schemainstance bound to the proper grammar
- Requires
- Schema Builder:
- SQL compilation fully delegated to driver-specific grammars
- CREATE / ALTER / DROP return multiple SQL statements
- Test suite updated:
- FakeConnection adjusted to new contract
- QueryBuilder, Schema, Migration tests aligned with new behavior
Fixed
- Fixed method signature mismatches in Intelephense
- Corrected SQLite behavior and missing type mappings
- Fixed SchemaHelper in support package
- Repaired ColumnDefinition attributes (
length,precision,scale,unsigned)
Removed
- Legacy single-driver DSN builder
- Deprecated schema compiler code no longer part of the package
Release v1.0.0
Added
-
Stabilized Query Builder API
- Finalized interfaces (
QueryBuilderInterface,ConnectionInterface) - Unified SQL compiler architecture
- Added reliable aggregate handling without mutating the builder
- Added consistent
toSql()+ bindings output across all query types
- Finalized interfaces (
-
DatabaseManager
- Multiple connections support
- Lazy connection initialization
- Full config-based connection resolver
connection(name)API
-
Connection layer
- Strict error handling via
QueryException/DatabaseException - Dedicated
transaction()wrapper with automatic rollback on failure - Strong return types and full interface coverage
- Strict error handling via
-
Schema Builder
- Table creation, modification and drop operations
- Full set of column types (integer families, text, JSON, datetime, boolean, UUID etc.)
- Index builder (primary, unique, index)
- Foreign key constraints
-
Migration System
- Migration repository with automatic table creation
- Migration runner with per-migration transactions
- Rollback & status commands
- Migration file resolver with multi-directory support
-
Standalone CLI
database migratedatabase migrate:rollbackdatabase migrate:statusdatabase make:migration- Autodiscovery of
database/migrationsdirectory
-
Test Suite (full coverage)
- FakeConnection for integration-like testing
- QueryBuilder grammar tests (select, joins, where, aggregates, pagination)
- Schema grammar tests
- MigrationRepository & Migrator tests
- Connection behavior tests (prepare, exceptions, transactions)
Changed
- Significantly refactored internal SQL grammar:
- Unified compiler pipeline for all query types
- Improved ORDER BY / GROUP BY / HAVING positioning rules
- More consistent parameter binding logic
- Rewritten migration runner to use explicit transactions
- Normalized naming conventions across all components (Builder, Grammar, Repository)
- Simplified QueryBuilder internals using condition and join objects (
WhereCondition,WhereGroup,JoinClause) - Improved developer experience for
insertGetId(),exists(),pluck(), and pagination methods
Fixed
- Nested where groups now compile with correct parentheses and precedence
- Raw expressions are no longer escaped incorrectly
- Pagination SQL no longer mutates the original builder state
- JOIN compiler now respects ordering and nested conditions
- Connection::table() now properly returns a query builder implementing the contract
- Numerous edge-case bugs found during test suite completion
Removed
- All deprecated pre-0.7.0 grammar logic
- Old connection helpers replaced with a typed, interface-driven API
- Legacy QueryBuilder internals rewritten or removed