laravel 使用artisan命令新增数据库字段
2013-09-05 12:07
543 查看
cmd 命令行 到项目目录,不是public那个目录
migrations目录下面就会生成一个文件,在里面修改即可
文档可见:http://v3.golaravel.com/docs/database/schema.html
分别执行如下,就可以了
D:\Program Files\wamp\www\Book>php artisan migrate:make add_machine_typ e_to_books Created Migration: 2013_09_05_104157_add_machine_type_to_books Generating optimized class loader
migrations目录下面就会生成一个文件,在里面修改即可
文档可见:http://v3.golaravel.com/docs/database/schema.html
<?php use Illuminate\Database\Migrations\Migration; class AddMachineTypeToBooks extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('books',function($table){ $table->integer('machine_type'); $table->string('lan_ip',100); $table->string('remote_ip',100); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('books',function($table){ $table->drop_column('machine_type'); $table->drop_column('lan_ip'); $table->drop_column('remote_ip'); }); } }
分别执行如下,就可以了
php artisan migrate:refresh php artisan db:seed
相关文章推荐
- laravel 使用artisan命令新增数据库字段
- laravel 使用artisan命令新增数据库字段
- Laravel 使用artisan命令 创建数据库表,实体类和controller
- Laravel基础(四)--使用Eloquent ORM操作数据库之新增记录
- 数据库Postgresql在使用Hibernate自动新增字段后插入不生效
- Laravel在Mac下使用php artisan migrate命令出现No such file or directory
- Laravel 下 artisan 命令工具使用
- laravel 新增数据库字段
- laravel中artisan工具(命令)的使用详解
- MongoDB_02之使用shell命令实现对数据库的操作
- 使用EXPDP IMPDP传输不同数据库的不同表空间(新增网络传输)
- 使用mysql load命令将业务生成的log导入到数据库中
- 数据库-使用查询到的不同字段的两条SQL的结果进行筛选查询
- 使用dbstart和dbshut命令启动和关闭数据库
- 使用adb查看数据库的一些命令
- 网站集所使用的内容数据库转移及相关stsadm命令
- 查找业务模块中使用的字段来自哪个数据库表
- Navicat 创建数据库和表之使用命令创建
- datagridview的使用,即时新增,更新,删除数据库数据
- Laravel artisan 命令工具