Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Daniel-Pablo's avatar

migrate a specific table

hi, I was wondering if there is a way to migrate a specific table that is inside a migration class, here is the example,

  1. inside
class CreateUsersTable extends Migration
{
    public function up()
    {
      Schema::create('users', function (Blueprint $table) {
         $table->bigIncrements('id');
         $table->string('name');
         $table->timestamps();
     });

there is the USER table and creates the user

but after that schema I got this one, and is new never migrated before

    public function up()
    {
      Schema::create('users', function (Blueprint $table) {
         $table->bigIncrements('id');
         $table->string('name');
         $table->timestamps();
     });

      Schema::create('wishContracts', function (Blueprint $table) {
         $table->bigIncrements('id');
         $table->unsignedBigInteger('user_id');
         $table->unsignedBigInteger('smart_contract_id');
         $table->timestamps();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
     });

i want to call something like this command

php artisan migrate --path=create_users_table --schema-path=wishContracts

and migrate just that table inside that class.. that can be done? thanks in advance -- if you know a plugin for this let me know

also, How I dump a specific migration table or full migration class? thanks in advance

0 likes
3 replies
bugsysha's avatar

Something like this should migrate only that specific migration.

php artisan migrate --path=database/migrations/2014_10_12_000000_create_users_table.php
1 like
Daniel-Pablo's avatar

@bugsysha thanks, I want to ask, I got a 10 SCHEMAs inside that class that contains that migrations, the thing is How I can migrate just one schema not all that class file... thanks in advance

bugsysha's avatar

There is no way for such thing. That is why you put everything in separate migration classes.

Please or to participate in this conversation.