0

I tried to do database migration to postgreSQL but when i run php artisan migrate it giving "nothing to migrate" response, what should i do

here's my code for migration :

<?php

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

class CreateUsersTable extends Migration
{
    /**
     *Run the migrations.
     *
     * @return void
     */
    public function up()
    {
    Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('email',50)->unique();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
        Schema::dropIfExists('users');
     }
}
4
  • are you migrating for the first time or you have changed table? Commented Nov 2, 2018 at 10:57
  • i'm migrating for the first time Commented Nov 2, 2018 at 11:07
  • @NelVanBalthazar Have you changed your env file to point to the postgres server, have you checked the database.php file in app/config/ Commented Nov 2, 2018 at 13:18
  • @MikeRodham i changed it but problem still happened Commented Nov 2, 2018 at 13:26

1 Answer 1

1

Try rollback and see what happens

php artisan migrate:rollback
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Man, i try to rollback and try to do "php artisan migrate" again, succesfully migrated , BUT i checked the table in database, the table doesn't exist. need help...
does your data base has a migrations table? it should be migrated by default when you migrate for the first time in laravel
no table at all. empty database. I check mysql database it was effected after rollback and migrate again, i get confused, i have pointed to postgreSQL by configure the .env, but why mysql database affected.
i'm using xampp and has cofigured the php.ini for postgreSQL also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.