Home > Article > Backend Development > laravel(二)migration leverage ratio gearing ratio pe rati
Migation in laravel is similar to a kind of data version control.
1. Create database
(1) Create a database based on the database php file
php artisan migrate
(2) If you find a creation error, you can undo
php artisan migrate:rollback
(3) Create in lar A php file used to create a database
php artisan make:migration create_articles_table --create=articles
//where articles specifies the table name
(4) Add fields
php artisan make:migration add_intro_column_to_articles - -table=articles
//Need to write in the newly created php file,
In the up() function:$table->string('xxx');
In the down() function:$table->dropColumn('xxx')
Note: dropColumn requires import package: doctrine/dbal
2.Update after database change
php artisan migrate:refresh
3.apache2 startup
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });sudo /etc/init.d/apache2 restart
The above introduces laravel (2) migration, including laravel and ratio content. I hope it will be helpful to friends who are interested in PHP tutorials.