Laravel migration to migrate data using tables

Detailed database migration link below:

https://learnku.com/docs/laravel/5.5/migrations/1329

[Specification] use Migrate development version management for database development

https://www.cgspread.com/9245.html

Why migrate? Rather than any other method

  1. Migrate allows developers to modify and maintain databases simple. It avoids the artificial handwritten SQL statements, you can easily move data between different databases. Which can also be traced to the migration script is executed, the developer can no longer worry about the state of the database in order to pay more attention to how to write a better system.
  2. We first review under the old method to update the database every time you need to add a table or, modify the structure of the table, whether you, you will do:
  3. Into the MySQL command line / phpMyadmin / other SQL tool (such as SQLyog)
  4. Or manually write SQL statements to do it (create table, create database, ...)

The old method of problem

1, any database operations do not know the time

Such as creating a database, or add a field to the table, you can not go to check when this field is added.
Unless you or your team have to deliberately write records. No. XX X X months add fields, reason: XX

2, database synchronization between team members

Every time someone achieve a new feature to create a new data table, others from above after git pull down,
is also going to run these SQL statements to create the same form.

Spent migrate

1, any database operations do not know the time

The problem by looking directly at the db / migrate / time in the file name to know

2, database synchronization between team members

pull code directly after completing rake db: migrate get away.

 

Guess you like

Origin blog.csdn.net/qq_29058883/article/details/94722697