dimanche 29 janvier 2017

Laravel - Mongodb [ jenssegers/laravel-mongodb ] - Schema Builder

I have an web app with mongodb, using jenssegers package.

Since I'm using mongodb, do I need to create any migration table? Jenssegers database driver also has (limited) schema builder support

Schema::create('users', function($collection)
{
    $collection->index('name');

    $collection->unique('email');
});


I found two different "answers". This guy is using the schema builder

enter image description here

And the Mulkave answer:

Q: "When i run the comman "php artisan migrate" then i am getting following error where as migration table is created into mongodb database:"

A: "You might have misinterpreted the purpose of MongoDB being a document database, you do not need to have migrations in document-based databases and this is what they're good a. They have dynamic schemas so all you'll have to do is save your model regardless of what attributes they have which means you'll have to tighten your application's business logic to make sure the models are being saved as you expected."


So, do I need migrations table? Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire