mercredi 26 juillet 2017

Laravel 5.2 nullable migration not working

I am trying to create a table in my laravel 5.2 where I want to make one of my column nullable but I am getting error :

I am using postgres as my database I have created a migration for my table which is :

       public function up()
{
  Schema::create('AbcContact', function (Blueprint $table) {
   $table->increments('id');
   $table->string('username');
   $table->string('alias');
   $table->string('nickname');
   $table->timestamps();
      });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
  Schema::drop('AbcContact');

}

And I am adding one more migration to change one my my column in this table and for that migration code is :

    public function up()
{
  Schema::table('AbcContact', function ($table) {
    $table->string('alias')->nullable()->change();
  });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    //
}

When I am running migratin I am getting this error:

   [Illuminate\Database\QueryException]                                         
       SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "abccontact" does n  
       ot exist (SQL: ALTER TABLE AbcContact ALTER alias DROP NOT NULL)          



       [PDOException]                                                               
       SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "abccontact" does n  
       ot exist     

I don't know why I am getting this error



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire