Monday, February 27, 2017

[SOLVED]Add new column to database table with migrations fails with - Nothing to migrate

I just learned how to use Migrations. I successfully created a table with this schema:
/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('units', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('description');
        $table->timestamps();
    });
}

Unfortunattely I missed the column path, so I've tried to add it. First I informed myselfe in the laravel documentation to learn how to add new columns.
From the documentation:
The table method on the Schema facade may be used to update existing tables.
My attempt:
/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('units', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('description');
        $table->timestamps();
    });

    Schema::table('units', function (Blueprint $table) {
        $table->string('path');
    });
}

However, after executing php artisan migrate I get Nothing to migrate.
What am I doing wrong?


from Latest question asked on Laravel tag.

via EdwardBlack

Advertisement