efureev / laravel-support-db
PostgreSQL features for Laravel's schema and query builders: partial indexes, views, CREATE TABLE LIKE, extensions, RETURNING, and PostgreSQL-only column types
Requires
- php: >=8.5
- ext-pdo: *
- illuminate/database: ^13.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.52
- larastan/larastan: ^3.12
- orchestra/testbench: ^11.0
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.0
- squizlabs/php_codesniffer: ^3.13.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v5.x-dev
- v5.5.0
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.0
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.x-dev
- v4.0.0
- v3.0.0
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.0
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.1
- v1.8.0
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- v0.0.3
- v0.0.2
- v0.0.1
- dev-laravel-12
This package is auto-updated.
Last update: 2026-09-12 23:37:05 UTC
README
PostgreSQL features for Laravel's schema and query builders.
Laravel's builders cover what every database can do. This package adds the PostgreSQL parts they
leave out — partial indexes, views, CREATE TABLE … LIKE, extensions, RETURNING, and the
PostgreSQL-only column types — using the same fluent style, so they read like the rest of a
migration.
It extends; it does not replace. Everything the framework already does keeps working unchanged.
Schema::create('users', static function (Blueprint $table) { $table->primaryUUID(); $table->string('email'); $table->softDeletes(); // one live user per address; soft-deleted rows do not collide $table->uniquePartial('email')->whereNull('deleted_at'); });
Install
composer require efureev/laravel-support-db
It registers itself through package discovery — no provider to add, no config to publish. Type-hint
the package's Blueprint in migrations to get the additions in your editor:
use Illuminate\Support\Facades\Schema; use Php\Support\Laravel\Database\Schema\Postgres\Blueprint; Schema::create('table', static function (Blueprint $table) { /* … */ });
| Version | |
|---|---|
| PHP | >= 8.5 |
| Laravel | >= 13.0 (illuminate/database) |
| PostgreSQL | 13 – 18, every one of them exercised in CI |
compression() needs PostgreSQL 14 and nullsNotDistinct() needs 15; everything else works from
13. The package takes effect on pgsql connections only — other drivers on the same application
are untouched.
Documentation
Read it at https://efureev.github.io/laravel-support-db/, or as markdown in
docs/.
The
docs/directory is not shipped in the Composer package — it would be dead weight invendor/— which is why the links below are absolute.
| Page | Covers |
|---|---|
| Getting started | Requirements, version floors, how the package hooks in, a first migration |
| Columns | The PostgreSQL-only column types, UUID key generation, TOAST compression |
| Indexes | Partial and unique-partial indexes, predicates, modifiers, GIN operator classes |
| Views | Plain and materialized views — create, refresh, inspect, drop, other schemas |
| Schema operations | CREATE TABLE … LIKE / AS TABLE / AS SELECT, DROP … CASCADE, extensions |
| Query builder | RETURNING on UPDATE and DELETE |
| Recipes | Thirteen realistic problems worked end to end |
| Behaviour notes | The things that are easy to trip over, and what Laravel 13 already does itself |
| Testing & contributing | Running the suite, and the gate a pull request has to pass |
What it adds
Partial and unique-partial indexes with a fluent WHERE · CREATE INDEX CONCURRENTLY and
NULLS NOT DISTINCT on them · GIN indexes with an operator class · views, including materialized
ones, with schema-qualified lookups · CREATE TABLE … LIKE / AS SELECT / AS TABLE ·
DROP TABLE … CASCADE · CREATE / DROP EXTENSION · column compression ·
UPDATE / DELETE … RETURNING · and shorthands for bit, numeric, xml, cidr, daterange,
tsrange, the geometric types, the array types, and UUID primary keys that need no extension.
Contributing
Issues and pull requests are welcome — see Testing & contributing for the gate CI runs.
License
MIT — see LICENSE.