Create migration file while creating table in Laravel Voyager
Asked Answered
F

1

6

I am using Voyager framework for Laravel. Wherenever I create table from Database Manager its creating table but its not creating any migration file. And its not good user interface who works on git repository(share the application's database schema). Everyone in the group has to create table in backend and have to work. This is not good.

but It creates table in database(phpmyadmin) and we have option to create Model(while creating table)

Any solution? need quick response

Forceps answered 16/5, 2018 at 7:34 Comment(0)
W
3

Unfortunately, Laravel Voyager doesn't make migrations for user tables.

There are two workarounds.

  1. Laravel Migrations Generator

Use this dev package to generate the migrations for the given tables. Availabe on GitHub at: https://github.com/Xethron/migrations-generator. View the documentation to see how to generate the migrations for the specific tables.

However, the collaborators will have to create the BREADs for them.

  1. Copying the database

While sharing the database, the laravel voyager config tables that have all the changes and specs will be available on all the collaborator accounts.

Laravel voyager saves all its configurations in tables. Hence removing the need to generate migrations. Porting the whole DB works for most of my projects since I work on most apps alone.

Whipsaw answered 16/5, 2018 at 7:47 Comment(3)
the first solution i felt it as best. But what if the case i changed column name or i deleted a column or I changed column type.. If I run again migration using the plugin it creates again new migration file. What happens in this case (it shows two migration file for the same table). Help me out in this as I am new to laravel and Laravel Voyager too. thanks in advanceForceps
You have to control the creation of migrations as it can be quite complex do deal with. Only create on migration at a time. If you change the table, delete the previous one and make it. Otherwise it becomes chaos.Whipsaw
As for the first solution you can use this package for new versions of laravel: github.com/kitloong/laravel-migrations-generatorHub

© 2022 - 2024 — McMap. All rights reserved.