-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
Laravel Version
12.20.0
PHP Version
8.4.8
Database Driver & Version
pgsql/17.5
Description
The creation of a GiST-Index requires a class operator as described in https://www.postgresql.org/docs/16/gist-builtin-opclasses.html
It must be either one of:
-
box_ops
-
circle_ops
-
inet_ops
-
multirange_ops
-
point_ops
-
poly_ops
-
range_ops
-
tsquery_ops
-
tsvector_ops
Currently, laravel ignores the operator class, thus causing it to fail on a migration. A fix of this issue would be highly appreciated since GiST-Indices are not uncommon in PostgreSQL.
Thank you very much for your attention and consideration.
Steps To Reproduce
CREATE TABLE public.payers_subscriptions (
id integer NOT NULL,
client_internet inet
);
CREATE INDEX payers_subscriptions_client_internet_idx ON public.payers_subscriptions USING gist (client_internet inet_ops);
composer require kitloong/laravel-migrations-generator
php artisan migrate:generate --ignore=users,cache,jobs,cache_locks,failed_jobs,job_batches,password_reset_tokens,sessions
Using connection: pgsql
Generating migrations for: payers_subscriptions
Do you want to log these migrations in the migrations table? (yes/no) [yes]:
Next Batch Number is: 2. We recommend using Batch Number 0 so that it becomes the "first" migration. [Default: 0] [0]:
Setting up Tables and Index migrations.
Created: /.../.../.../database/migrations/2025_07_09_013525_create_payers_subscriptions_table.php
Setting up Views migrations.
Setting up Stored Procedures migrations.
Setting up Foreign Key migrations.
Finished!
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('payers_subscriptions', function (Blueprint $table) {
$table->integer('id');
$table->ipAddress('client_internet')->nullable();
$table->spatialIndex(['client_internet'], 'payers_subscriptions_client_internet_idx');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('payers_subscriptions');
}
};
php artisan migrate:refresh
INFO Rolling back migrations.
0001_01_01_000002_create_jobs_table ................................................................................................. 63.96ms DONE
0001_01_01_000001_create_cache_table ................................................................................................ 16.58ms DONE
0001_01_01_000000_create_users_table ................................................................................................ 26.77ms DONE
2025_07_09_013525_create_payers_subscriptions_table ................................................................................. 11.78ms DONE
INFO Running migrations.
0001_01_01_000000_create_users_table ................................................................................................. 7.91ms DONE
0001_01_01_000001_create_cache_table ................................................................................................. 5.27ms DONE
0001_01_01_000002_create_jobs_table .................................................................................................. 6.88ms DONE
2025_07_09_013525_create_payers_subscriptions_table .................................................................................. 9.52ms FAIL
Illuminate\Database\QueryException
SQLSTATE[42704]: Undefined object: 7 ERROR: data type inet has no default operator class for access method "gist"
HINT: You must specify an operator class for the index or define a default operator class for the data type. (Connection: pgsql, SQL: create index "payers_subscriptions_client_internet_idx" on "payers_subscriptions" using gist ("client_internet"))at vendor/laravel/framework/src/Illuminate/Database/Connection.php:822
818▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
819▕ );
820▕ }
821▕
➜ 822▕ throw new QueryException(
823▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
824▕ );
825▕ }
826▕ }
+9 vendor frames10 database/migrations/2025_07_09_013525_create_payers_subscriptions_table.php:14
Illuminate\Support\Facades\Facade::__callStatic("create")
+38 vendor frames49 artisan:16
Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))
php artisan about
Environment ......................................................................................................................................
Application Name .................................................................................................................... [name]
Laravel Version .......................................................................................................................... 12.20.0
PHP Version ................................................................................................................................ 8.4.8
Composer Version .......................................................................................................................... 2.8.10
Environment ................................................................................................................................ local
Debug Mode ............................................................................................................................... ENABLED
URL ............................................................................................................................. [url]
Maintenance Mode ............................................................................................................................. OFF
Timezone ..................................................................................................................................... UTC
Locale ........................................................................................................................................ enCache ............................................................................................................................................
Config ................................................................................................................................ NOT CACHED
Events ................................................................................................................................ NOT CACHED
Routes ................................................................................................................................ NOT CACHED
Views ..................................................................................................................................... CACHEDDrivers ..........................................................................................................................................
Broadcasting ................................................................................................................................. log
Cache ................................................................................................................................... database
Database ................................................................................................................................... pgsql
Logs .............................................................................................................................. stack / single
Mail ........................................................................................................................................ smtp
Queue ................................................................................................................................... database
Session ................................................................................................................................. databaseStorage ..........................................................................................................................................
public/storage ........................................................................................................................ NOT LINKED
php artisan db:show
PostgreSQL .................................................................................................................................. 17.5
Connection ................................................................................................................................. pgsql
Database ........................................................................................................................ [dbname]
Host ................................................................................................................................... 127.0.0.1
Port ........................................................................................................................................ 5432
Username ........................................................................................................................ [username]
URL ..............................................................................................................................................
Open Connections ............................................................................................................................... 8
Tables ........................................................................................................................................ 10
Total Size ............................................................................................................................. 240.00 KBSchema / Table .............................................................................................................................. Size
public / cache .......................................................................................................................... 16.00 KB
public / cache_locks .................................................................................................................... 16.00 KB
public / failed_jobs .................................................................................................................... 24.00 KB
public / job_batches .................................................................................................................... 16.00 KB
public / jobs ........................................................................................................................... 24.00 KB
public / migrations ..................................................................................................................... 24.00 KB
public / password_reset_tokens .......................................................................................................... 16.00 KB
public / payers_subscriptions ........................................................................................................... 16.00 KB
public / sessions ....................................................................................................................... 64.00 KB
public / users .......................................................................................................................... 24.00 KB