master php,phpmig-masterPHP迁移库

phpmig-masterPHP迁移库

php artisan migrate #输出Migration table created successfully. Migrated: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_100000_create_password_resets_table

php artisan migrate:rollback #输出Rolled back: 2014_10_12_100000_create_password_resets_table Rolled back: 2014_10_12_000000_create_users_table

php artisan make:migration create_article_table --create='articles' #输出Created Migration: 2015_03_28_050138_create_article_table

use Illuminate\Database\Schema\Blueprint;

use Illuminate\Database\Migrations\Migration;

class CreateArticleTable extends Migration {

/**

* Run the migrations.

*

* @return void

*/

public function up()

{

Schema::create('articles', function(Blueprint $table)

{

$table->increments('id');

$table->timestamps();

});

}

/**

* Reverse the migrations.

*

* @return void

*/

public function down()

{

Schema::drop('articles');

}

}

database migrations 是laravel最强大的功能之一。数据库迁移可以理解为数据库的版本控制器。

在 database/migrations 目录中包含两个迁移文件,一个建立用户表,一个用于用户密码重置。

在迁移文件中,up 方法用于创建数据表,down方法用于回滚,也就是删除数据表。

申明:php中文网下载站匠心打造专业的IT资源下载站!一切资源免费,来源网络收集,请自行检测软件的完整性。交流QQ群:916808767

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值