mercredi 25 octobre 2017

Laravel migration deployment

Just a quick one really

I have an existing Laravel app

I want to use a migration to add some columns to an existing table

So i do the following:

php artisan make:migration add_columns_to_table

Which creates a file in my migrations folder called:

2017_10_25_124938_add_column_to_table.php

And also creates an entry in my migrations table in the database. All good.

I can edit the migration file (adding the columns etc) and run

php artisan migrate

And everything works great

Now - my question is this:

When i come to deploy to live i am presuming I would log onto the live box and run the create migration command again:

php artisan make:migration add_columns_to_table

But this will create a migration with a different name to the one i created / tested locally?

So - do i then need to manually copy the code from my local 2017_10_25_124938_add_column_to_table.php migration file to the one created on the live box?

That seems a bit backwards and fiddly

What is the best way of creating and testing a migration locally and then deploying it to live when the create migration command creates a different named migration file (and DB entry) on the live box?

Or have i got the wrong end of the stick?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xn9Gu7
via IFTTT

Aucun commentaire:

Enregistrer un commentaire