dongli1887 2016-10-29 09:41
浏览 12

Laravel创建表,其他字段

I hav question, I create database, which have 6 tables and make recommendation

php artisan make:migration create_users_table2

Return me score Migration table created successfully. Created Migration: 2016_10_29_092820_create_users_table2

then make recommendation php artisan migrate

Return me score Migration table created successfully. Migrated: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_100000_create_password_resets_table Migrated: 2016_10_29_092820_create_users_table2

and have created databases, but other from other tables, That is my file about name 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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 目详情-五一模拟赛详情页
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line