You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just upgraded to Laravel 10, but encountered an issue with our index compilation.
We're actually using CockroachDB, not PostgreSQL but the use-case should be identical and behave the same for both.
In our migrations we have some columns as jsonb and we're adding a GIN index on an attribute of that JSON column.
The migration looks like this:
Schema::create('examples', function (Blueprint $table) {
$table->jsonb('meta');
$table->rawIndex('("meta"->\'attribute\')', 'examples_meta_attribute_index')->algorithm('gin');
});
However starting with Laravel 10, expressions can't just be cast to string. This means that this line is now not applicable for all possible cases:
Its fixed with release 0.27.1. The problem was not changed in Laravel 10. I never handled rawIndex definitions correctly. They are not mentioned in the documentation so I completely missed them.
There's no real documentation for tests, its just PHPUnit with some additions. The numbers at the end of everything are just random nums to prevent name clashes.
As I rewrite every PR the best approach would be just asking whether I am ok with a certain feature, work on a draft and I polish it up to fit my style. Or the way I would do it.
We just upgraded to Laravel 10, but encountered an issue with our index compilation.
We're actually using CockroachDB, not PostgreSQL but the use-case should be identical and behave the same for both.
In our migrations we have some columns as
jsonband we're adding a GIN index on an attribute of that JSON column.The migration looks like this:
However starting with Laravel 10, expressions can't just be cast to string. This means that this line is now not applicable for all possible cases:
laravel-postgresql-enhanced/src/Schema/Grammars/GrammarIndex.php
Line 132 in aea2a6a
I believe fixing it would be as simple as changing from
stringtostring|Expressionand adding the same functionality that already exists in laravel-query-expressions asstringizehttps://github.com/tpetry/laravel-query-expressions/blob/4ca06ed9abf0ac5e52f83a613124389d4c03392b/src/Concerns/StringizeExpression.php#L12-L18
There are possibly more cases where there is currently an expectation for string but we might receive an Expression instead.
I'm happy to send a pull-request, but I'm not quite sure how one gets those fancy numbers for columns and tables that are used in other tests :)
The text was updated successfully, but these errors were encountered: