Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在laravel中迁移特定表_Php_Laravel_Cmd_Command_Laravel Artisan - Fatal编程技术网

Php 在laravel中迁移特定表

Php 在laravel中迁移特定表,php,laravel,cmd,command,laravel-artisan,Php,Laravel,Cmd,Command,Laravel Artisan,使用命令php artisan migrate迁移所有表。但我有一个employees表,我和其他表一起迁移了它。但是它没有被迁移(我在phpmyadmin中看不到它)。现在,当我再次使用phpartisanmigrate命令时,它不会显示任何要迁移的内容。如何迁移特定的employees表 <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; clas

使用命令
php artisan migrate
迁移所有表。但我有一个employees表,我和其他表一起迁移了它。但是它没有被迁移(我在phpmyadmin中看不到它)。现在,当我再次使用
phpartisanmigrate
命令时,它不会显示任何要迁移的内容。如何迁移特定的employees表

<?php

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

class Employees extends Migration
{
    public function up()
    {
        Schema::create('employees', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('contact_number');
            $table->timestamps();       
        });

        $faker = Faker\Factory::create();

        $limit = 33;

        for ($i = 0; $i < $limit; $i++) {
            DB::table('employees')->insert([ //,
                'name' => $faker->name,
                'email' => $faker->unique()->email,
                'contact_number' => $faker->phoneNumber,
            ]);
        }
    }

    public function down()
    {
        Schema::drop('employees');
    }
}

运行
php artisan migrate
时是否出现任何错误?另外,您不应该在迁移中看到数据库,这就是它的用途。没有任何错误。它不显示任何要迁移的内容。@BogdanThen它可能意味着employees表迁移之前已迁移。您以前运行过迁移吗。如果你这么做了,你需要把它滚回去。您可以检查数据库中的
migrations
表,查看是否可以找到迁移文件名。如果它在最后一批中,那么您可以使用
php artisan migrate:rollback
撤消这些更改并再次尝试运行它。尝试php artisan migrate:refresh,然后查看该表是否已迁移。另一方面,根据我的猜测,没有办法迁移单个表。