Skip to content

Commit

Permalink
fix: compatability to Laravel 11.25 (resolves #100)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpetry committed Sep 27, 2024
1 parent a6783c5 commit a14719f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2024-09-27
### Backward Incompatible Changes
* The dimensions value for the `vector` migration type is now required to copy the behavior of Laravel 11.25.0

## [1.1.1] - 2024-09-23
### Fixed
* Support PostgreSQL's `^@` starts with operator.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,9 @@ Schema::create('comments', function (Blueprint $table) {

# Breaking Changes

* **2.0.0**
* Laravel 11.25 released a new `vector` migration type so the behaviour had to be aligned with Laravel's implementation:
* The `$dimensions` parameter (formerly with a default of 1536) is now required
* **1.0.0**
* Laravel 11.17 released a new `whereLike` and `orWhereLike` builder method so the behaviour had to be aligned with Laravel's implementation:
* The value is now searched case-insensitive by default instead of case-sensitive
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/BlueprintTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function varbit(string $column, ?int $length = null): ColumnDefinition
/**
* Create a new vector column on the table.
*/
public function vector(string $column, int $dimensions = 1536): ColumnDefinition
public function vector($column, $dimensions): ColumnDefinition

Check failure on line 254 in src/Schema/BlueprintTypes.php

View workflow job for this annotation

GitHub Actions / P8.2 - L11.x-dev

Declaration of Tpetry\PostgresqlEnhanced\Schema\BlueprintTypes::vector($column, $dimensions): Illuminate\Database\Schema\ColumnDefinition must be compatible with Illuminate\Database\Schema\Blueprint::vector($column, $dimensions = null)

Check failure on line 254 in src/Schema/BlueprintTypes.php

View workflow job for this annotation

GitHub Actions / P8.3 - L11.x-dev

Declaration of Tpetry\PostgresqlEnhanced\Schema\BlueprintTypes::vector($column, $dimensions): Illuminate\Database\Schema\ColumnDefinition must be compatible with Illuminate\Database\Schema\Blueprint::vector($column, $dimensions = null)
{
return $this->addColumn('vector', $column, compact('dimensions'));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Migration/TypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ public function testVectorTypeIsSupported(): void

$this->getConnection()->statement('CREATE EXTENSION IF NOT EXISTS vector');
$queries = $this->runMigrations(
fnCreate: fn (Blueprint $table) => $table->vector('col'),
fnChange: fn (Blueprint $table) => $table->vector('col')->change(),
fnCreate: fn (Blueprint $table) => $table->vector('col', 1536),
fnChange: fn (Blueprint $table) => $table->vector('col', 1536)->change(),
);

$this->assertEquals('create table "test" ("col" vector(1536) not null)', $queries[0]['query'] ?? null);
Expand Down

0 comments on commit a14719f

Please sign in to comment.