首页 >后端开发 >php教程 >使用laravel 的artisan快速创建表

使用laravel 的artisan快速创建表

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-23 13:31:001363浏览

创建migrate 文件


php artisan make:migration create_comments_table
编辑表字段


<?phpuse 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





声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn