laravel-mongodb
laravel-mongodb copied to clipboard
Is support for Laravel's Schema dump possible/planned?
Laravel added a schema:dump
command in version 8: https://github.com/laravel/framework/pull/32275
Running php artisan schema:dump --database=mongodb
crashes with the following error:
TypeError
call_user_func_array(): Argument #1 ($callback) must be a valid callback, class MongoDB\Database does not have a method "getSchemaState"
at vendor/jenssegers/mongodb/src/Connection.php:304
300▕ * @return mixed
301▕ */
302▕ public function __call($method, $parameters)
303▕ {
➜ 304▕ return call_user_func_array([$this->db, $method], $parameters);
305▕ }
306▕ }
307▕
Versions:
- PHP 8.1
- Laravel 9.21
- jenssegers/mongodb 3.9.1
This Laravel feature uses mysqldump
to export the database structure only.
mongodump output contains the documents in the database and the index definitions.
We could reimplement this feature using MongoDB\Collection::listIndexes()
. We will have to specify our own data format. Ideally, we could directly generate a migration file to create indexes.
Tracking this feature request in PHPORM-115