Laravel创建表,其他字段为

时间:2016-10-29 09:41:07

标签: php laravel-5

我有问题,我创建了数据库,它有6个表并提出建议

php artisan make:migration create_users_table2

返回我的分数 迁移表已成功创建。 创建迁移:2016_10_29_092820_create_users_table2

然后推荐php artisan migrate

返回我的分数 迁移表已成功创建。 已迁移:2014_10_12_000000_create_users_table 已迁移:2014_10_12_100000_create_password_resets_table 已迁移:2016_10_29_092820_create_users_table2

并创建了数据库,但其他表中的数据库, 这是关于名称2014_10_12_000000_create_users_table

的文件
<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('login',60);
            $table->string('email');
            $table->integer('date_registration');
            $table->string('password',200);
            $table->string('permissions',1);
            $table->rememberToken();
            $table->timestamps();
        });

       Schema::create('statistics', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('date');
            $table->string('variable_http_user_agent',200)
            $table->string('page',200);
            $table->string('ip',20);
            $table->string('user',60);
        });

       Schema::create('products', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',100);
            $table->integer('id_category');
            $table->integer('id_category2');
            $table->float('price');
            $table->text('description');
            $table->bool('auction');
            $table->bool('sold');
            $table->integer('id_usera');
            $table->integer('quantity');
            $table->string('path_to_image',100);

        });        
       Schema::create('basket', function (Blueprint $table) {
            $table->increments('id');
            $table->string('quantity_products',100);
            $table->integer('id_usera');

        });        
       Schema::create('category', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',100);

        });        
       Schema::create('category2', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',100);

        });        

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
        Schema::drop('statistics');
        Schema::drop('products');
        Schema::drop('basket');
        Schema::drop('category');
        Schema::drop('category2');
    }
}

0 个答案:

没有答案