How to convert Laravel migrations to raw SQL scripts?

后端 未结 5 1397
孤独总比滥情好
孤独总比滥情好 2021-01-30 03:33

Developers of my team are really used to the power of Laravel migrations, they are working great on local machines and our dev servers. But customer\'s database admin will not a

5条回答
  •  再見小時候
    2021-01-30 03:40

    Just in case you are facing the same problem as I did:

    php artisan migrate --pretend

    did not output anything, yet runs the SQLs without adding the record to migrations. In other words,

    • it does the SQL job, which was not intended
    • returned nothing, which was the reason I did the call and
    • did not add the entry to migrations, which sort of destroys the situations as I was not able to re-run the migration without manually remove tables

    The reason for it was my setup with several databases, which are addressed with

    Schema::connection('master')->create('...

    More on that issue you may find here: https://github.com/laravel/framework/issues/13431

    Sadly, a Laravel developer closed the issue, quote "Closing since the issue seems to be a rare edge case that can be solved with a workaround.", so there is not much hope, it will be fixed anytime soon. For my maybe rare case, I'll use a third party SQL diff checker.

    Cheers

提交回复
热议问题