Why do I use migration to operate a database in a laravel table?

Source: Internet
Author: User

The local server is: Wampserver
A new Laravel5 project was created with the composer command under the WWW directory, and the version is 5.1.26
In many laravel introductory tutorials, you create data tables with commands, and then migrate and populate them, what's the difference between building a table directly in phpMyAdmin or Navicat premium? If it is the same, then what are the benefits of using Laravel's migration?

After this issue, learn about Jellybool's Laravel series tutorial (https://laravist.com/), here is the text version (https://jellybool.com/), in tutorial four found the answer:
Migration can be thought of as a database version of the management tool, such as Git version of the project file management, you can rollback,reset (through the PHP artisan command to see the specific command)
So actually using migration to create a table is the same as creating a table directly, except that using migration has the additional ability to manage the database: Rollback/reset/update, etc.

Reply content:

The local server is: Wampserver
A new Laravel5 project was created with the composer command under the WWW directory, and the version is 5.1.26
In many laravel introductory tutorials, you create data tables with commands, and then migrate and populate them, what's the difference between building a table directly in phpMyAdmin or Navicat premium? If it is the same, then what are the benefits of using Laravel's migration?

After this issue, learn about Jellybool's Laravel series tutorial (https://laravist.com/), here is the text version (https://jellybool.com/), in tutorial four found the answer:
Migration can be thought of as a database version of the management tool, such as Git version of the project file management, you can rollback,reset (through the PHP artisan command to see the specific command)
So actually using migration to create a table is the same as creating a table directly, except that using migration has the additional ability to manage the database: Rollback/reset/update, etc.

Use this migration
The advantage is that you can keep the structure information of the following table directly in your project, and because the subsequent SQL is actually generated, someday you don't want to switch to pqsql with MySQL, SQLite or even Oracle will generate the statement for you by ORM.
Then there are additional versioning aspects to see if you need these features to make an assessment.

Of course you can not use this tool completely, in your own way to build a table, and nothing wrong

Incorporate schema into version control for easy tracking and deploy
and (as long as content does not conflict) can be developed in parallel by multiple people

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.