Search code examples
laravel-9

laravel: is it possible to make a migration from DB to the code?


I'd like to make some changes on the database side (PHPMyAdmin) since the GUI is user-friendly. Now, I can't figure out how to update my code model with the actual DB structure. Picture for better understanding: enter image description here

I use Laravel version 9 and a thank you in advance.


Solution

  • There is a kitloong/laravel-migrations-generator package which generates migrations for all or some tables:

    php artisan migrate:generate
    

    or

    php artisan migrate:generate --tables="table1,table2"