- How do I install the SingleStoreDB Laravel driver?
- Run `composer require singlestoredb/singlestoredb-laravel` and update your `config/database.php` to use the `singlestoredb` connection driver instead of `mysql`. The package replaces Laravel’s MySQL driver with SingleStoreDB-specific optimizations.
- Does this driver support SingleStoreDB’s Universal Storage (columnstore) tables?
- Yes. Use `columnstore()` in migrations to define Universal Storage tables. The driver extends Laravel’s schema builder to support SingleStoreDB-specific features like `shardKey()`, `sortKey()`, and `columnstore()` for hybrid transactional/analytical workloads.
- Will my existing Laravel Eloquent models work with SingleStoreDB?
- Mostly yes. The driver wraps Laravel’s MySQL driver, so existing Eloquent queries will work. However, SingleStoreDB-specific features (e.g., shard keys, computed columns) require explicit migration syntax. Test with a staging environment first.
- How do I configure persistent connections for better performance?
- Add `'options' => [PDO::ATTR_PERSISTENT => true]`, along with SSL settings if using SingleStoreDB Managed Service, in your `config/database.php` under the `singlestoredb` connection. Persistent connections reduce overhead but may need cleanup in long-running Laravel processes.
- What Laravel versions are officially supported?
- The driver is tested across a matrix of PHP/Laravel versions, including Laravel 9+ and PHP 8.1+. Check the GitHub Actions workflow for the latest compatibility matrix. For PHP <8.1, workarounds are needed due to PDO quirks.
- Can I use JSON columns in SingleStoreDB with this driver?
- Yes. The driver includes improved JSON column support. Use `json()` in migrations (e.g., `$table->json('metadata')`) and query JSON data with Laravel’s built-in JSON helpers like `->whereJsonContains()`.
- How do I handle SingleStoreDB Managed Service SSL requirements?
- Add SSL options to your `config/database.php` connection: `'sslmode' => 'verify-full', 'sslcert' => base_path('singlestore_bundle.pem')`. The driver supports standard MySQL SSL/TLS configurations for secure connections.
- Are there limitations with Laravel’s Query Builder (e.g., ORDER BY in DELETE)?
- Yes. Some Laravel Query Builder methods (e.g., `DELETE ... ORDER BY`) aren’t directly supported by SingleStoreDB. Configure the driver to ignore such clauses or rewrite queries manually. Check the README for `ignore_order_by_in_deletes`.
- How do I migrate an existing Laravel app from MySQL to SingleStoreDB?
- Start by updating your `config/database.php` to use the `singlestoredb` driver. Test migrations with SingleStoreDB-specific features (e.g., `shardKey()`) in a staging environment. Use `php artisan migrate:fresh` to rebuild the schema if needed.
- What alternatives exist for SingleStoreDB in Laravel?
- For MySQL-compatible databases, consider `doctrine/dbal` or raw PDO for direct SingleStoreDB access, but they lack Laravel’s Eloquent integration. This driver is the official, Laravel-native solution for SingleStoreDB, offering seamless Eloquent and migration support.