您的位置:首页 > 编程语言 > PHP开发

laravel 使用artisan命令新增数据库字段

2016-11-15 07:54 501 查看
php artisan make:migration create_comments_table

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comment',function(Blueprint $table){
$table->engine = 'InnoDB';
$table->increments('id');
$table->integer('news_id');
$table->string('author_name');
$table->string('author_url');
$table->string('author_key');
$table->string('ip');
$table->string('message');
$table->string('mail');
$table->integer('create_time');
$table->integer('parent_id');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}

}

php artisan migrate
php artisan migrate:refresh
php artisan db:seed
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: