新建迁移文件
数据迁移方法
artisan命令行:php artisan make:migration create_students_table --create=students
方法二:创建模型的同时创建表 php artisan make:model Article -m
php artisan migrate Run the database migrations
database/migrations
数据迁移文件
新建迁移文件
1.新建一个students表的迁移文件
php artisan make:migration create_student_table
--table 和 --create 参数可以用来指定数据表名称,以及迁移文件是否要建立新的数据表
2.生成模型的同时生成迁移文件
php artisan make:model Student -m
创建新数据表
迁移文件内容 & 执行迁移php artisan migrate
表结构--
新建迁移文件
执行迁移文件命令
php artisan migrate
创建表
修改迁移文件
第二种方式
第一种方式
表结构如下
迁移文件两种方式
Migration迁移
生成迁移文件有两种方式:
1、新建一个数据表的迁移文件。
php artisan make:migration create_students_table
--table 和 --create 参数可以用来指定数据表名称,以及迁移文件是否要建立新的数据表。
2、生成模型的同时生成迁移文件。
php artisan make:model Student -m
php artisan migrate
php artisan make:model Article -m