Skip to content

Releases: codemonster-ru/database

Release v2.0.0

22 Dec 15:43

Choose a tag to compare

Added

  • Schema: GrammarResolver and Schema::forConnection() to centralize grammar selection.
  • QueryBuilder: configurable empty whereIn/whereNotIn behavior.
  • Docs/typing: richer PHPDoc generics for ModelQuery/relations and query builder return shapes.

Changed

  • QueryBuilder: improved alias handling for select/value/pluck and table.* 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

21 Dec 17:12

Choose a tag to compare

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 echo for stdout; errors remain on stderr.

Release v1.5.0

21 Dec 06:45

Choose a tag to compare

Added

  • Seeders: New seeding system with Seeder, SeederRunner, and SeedPathResolver.
  • CLI seed commands: seed and make:seed with 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

10 Dec 17:01

Choose a tag to compare

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

10 Dec 14:31

Choose a tag to compare

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

10 Dec 12:46

Choose a tag to compare

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

10 Dec 05:26

Choose a tag to compare

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

09 Dec 14:01

Choose a tag to compare

Added

  • Multi-driver connection support

    • Added driver option (mysql, sqlite)
    • Automatic DSN selection based on driver
    • SQLite in-memory support (sqlite::memory:)
  • Schema Grammars System

    • New extensible Grammar architecture
    • Implemented MySqlGrammar
    • Implemented SQLiteGrammar
    • Added implementations for:
      • compileCreate
      • compileDrop
      • compileDropIfExists
      • compileAlter
      • compileRenameTable
      • compileColumn
      • compileForeign
      • compileInlineForeign
  • Improved Blueprint & ColumnDefinition

    • Full type map with consistent options (length, precision, scale)
    • Unified modifiers: nullable, default, unsigned, autoIncrement, comment, primary, unique, change

Changed

  • Connection:
    • Requires driver explicitly
    • DSN now depends on the selected driver
    • Returns a Schema instance bound to the proper grammar
  • 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

07 Dec 18:35

Choose a tag to compare

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
  • 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
  • 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 migrate
    • database migrate:rollback
    • database migrate:status
    • database make:migration
    • Autodiscovery of database/migrations directory
  • 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