Download the PHP package ylsideas/cockroachdb-laravel without Composer
On this page you can find all versions of the php package ylsideas/cockroachdb-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ylsideas/cockroachdb-laravel
More information about ylsideas/cockroachdb-laravel
Files in ylsideas/cockroachdb-laravel
Package cockroachdb-laravel
Short Description This is my package cockroachdb-laravel
License MIT
Homepage https://github.com/ylsideas/cockroachdb-laravel
Informations about the package cockroachdb-laravel
CockroachDB Driver for Laravel
A driver/grammar for Laravel that works with CockroachDB. While CockroachDB is compatible with Postgresql, this support is not 1 to 1 meaning you may run into issues, this driver hopes to resolve those problems as much as possible.
Laravel 9 through to Laravel 11 is supported and tested against CockroachDB 22 & 23.
Supporting Open Source
Peter Fox here, I just want to say this project has been my hardest yet. It's been a real labour of love to make and takes up a lot of time trying to organise the test suite so that compatibility is maintained between Eloquent and CockroachDB.
I see a lot of promise in using CockroachDB's serverless offering which is what compelled me to go down this route originally. You can read an article I made about using their service.
If you're using this project at all then do please consider sponsoring me as a way of encouraging more development.
Installation
You can install the package via composer:
You need to add the connection type to the database config:
You can also use URLs.
Usage
To enable set DB_CONNECTION=crdb
in your .env.
Notes
CockroachDB should work inline with the feature set of Postgresql, with some exceptions. You can look at the features of each CockroachDB server in the CockroachDB Docs.
Deletes with Joins
CockroachDB does not support performing deletes using joins. If you wish to do something like this you will need to use a sub-query instead.
At current if you try to call the delete
method of the Query builder together with a join
then
a YlsIdeas\CockroachDb\Exceptions\FeatureNotSupportedException
exception will be thrown.
Fulltext Search
Eloquent and Postgresql support Fulltext search. CockroachDB does not support any full text search meaning the feature cannot be used when using this driver.
At current if you try to create a Fulltext index using the Schema builder or try to use the whereFulltext
method of the Query builder a YlsIdeas\CockroachDb\Exceptions\FeatureNotSupportedException
exception will be thrown.
Serverless Support
Cockroach Serverless requires you to provide a cluster with connection.
Laravel doesn't provide this out of the box, so, it's being implemented as an extra cluster
parameter in the
database config. Just pass the cluster identification from CockroachDB Serverless.
Schema Dumps
You may use schema dumps. I'm not 100% sure the functionality is correct in line with other drivers. Please raise an issue if it isn't working as expect for you.
You may also use a URL in the following format.
Testing
The tests try to closely follow the same functionality of the grammar provided by Laravel by lifting the tests straight from laravel/framework. This does provide some complications. Namely, cockroachdb is designed to be distributed so primary keys do not occur in sequence.
Tests should also try to be compatible with not just the latest version of Laravel but across Laravel 8, 9 and 10, this requires some tests to be skipped.
You can run up a local cockroachDB test instance using Docker compose.
If you need to you may run the docker compose file with different cockroachdb versions
Then run the following PHP script to create a test database and user
Afterwards you can run the test suite.
To clean up, you only need stop docker composer.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Peter Fox
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of cockroachdb-laravel with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version 11.*|10.*|9.*