1

I designed a database in MYSQL. Now I want to connect that with my Laravel application. But after researching, I understand that I need to migrate the database into Laravel by creating migration tables. But doing the same thing that I did in MySQL is tedious. I think there is another way to do the stuff. After searching I got this article from stackoverflow, but this is related to yii framework. I think someone knows here the solution of my problem.

Siddikur
  • 31
  • 6

3 Answers3

4

I don't see a problem here, you can just connect Laravel to your DB (by editing your .env file) without any problems, migration files are just an easier way to design and implement your tables (also altering your tables' scheme on production is a very useful usage for migrations), but with that being done then no further actions are required, and you are good to go!

Yasser Sebai
  • 260
  • 2
  • 11
1

it's pretty obvious, you can update the database setting in the .env file and use DB::table('your_table_name') and get whatever query you want.

zarin
  • 7
  • 3
1

The upside of using migrations is that the exact same database can be created on different systems (ex: co-workers or acceptance/production servers).

Laravel migrations have an up and a down function so you can rollback to a specific version if something went wrong, very usefull when publishing your code.

That being said, co-workers could also review the database changes and for example hint at using more indexes and foreign keys.

As the other comments said, it's not a requirement you use migrations but it has considerable advantages versus creating and updating the database manually.

John Zwarthoed
  • 1,239
  • 7
  • 12