Reputation: 317
using command php artisan migrate
migrates all the tables. but i have employees table that i migrated along with other tables. but it is not migrated (i cannot see it in phpmyadmin). now when i again use php artisan migrate
command it displays nothing to migrate. How can i migrate that specific employees table?
<?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');
}
}
Upvotes: 3
Views: 6199
Reputation: 91
Don't forget to add: --path
E.g
php artisan migrate --path="database/migrations/2025_07_16_145318_create_expression_of_interests_table.php"
Upvotes: 3
Reputation: 392
php artisan migrate path="database/migrations/Your_Migration_File_Name_table.php"
Upvotes: 1