Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does php artisan migrate nothing?

Running "php artisan migrate" does nothing: no database modifications, no message(olso no "nothing to migrate"), no error.

No records are being added to table migrations as well.

Previously, the command "php artisan migrate" was working fine.

One of the migration files in folder database/migrations has this content:

<?php

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

class VidsTableEdit14 extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('vids', function(Blueprint $table)
        {
            //
            $table->integer('test');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('vids', function(Blueprint $table)
        {
            //
        });
    }

}

How to make "php artisan migrate" working?

like image 500
Charles Vlug Avatar asked May 22 '15 09:05

Charles Vlug


People also ask

How does php artisan migrate work?

How does php artisan migrate work? php artisan migrate:reset reverses all migration, unlike :rollback . php artisan migrate:fresh is used when we want a fresh or new installation of our database. It deletes all the existing tables of the database and runs the migrate command.

Is migration necessary in Laravel?

Migrations are optional but recommended. @ecksdee if you don't add a migration which creates a table in the database then you don't need Model in Laravel terms at all, because an Eloquent model is just an object relational mapper to a table that is part of your database.

What is php artisan migrate rollback?

By default, php artisan migrate:rollback will rollback all of your database migrations. By specifying --step=1 , you're saying that you only want to rollback the latest database migration. Plus, if you change the number, e.g. into --step=2 , you're telling Laravel to only rollback the last two migrations.

What does php artisan DB do?

The Laravel PHP artisan serve command helps running applications on the PHP development server. As a developer, you can use Laravel artisan serve to develop and test various functions within the application. It also accepts two additional options. You can use the host for changing application's address and port.


1 Answers

If the migration stops working suddenly there is probably a syntax error somewhere in one of your migrations. If you suddenly get a class not found error be suspicious of a syntax error.

like image 191
DustBowlDarrell Avatar answered Oct 09 '22 01:10

DustBowlDarrell