dimanche 28 juillet 2019

Error Users already exits when trying to create a column to an existing table

I'm trying to add a new column to an existing table 'users'. I created a new migration 'add_privilege_column_to_users_table'. When I try to run the php artisan migration, I get an error that the 'users' table already exists. Am I missing something here?

I've already tried several methods from Googling and from other people that have had the same problem here at starckoverflow. But none of the code from here helped me.

class AddPrivilegesColumnToUsersTable extends Migration
{
/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::table('users', function (Blueprint $table) {

        $table->string('privilege_type')->after('remember_token');

    });
}

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

    });
}
}

PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists")

That's the specific error that I get when I run php artisan migrate. I'm just trying to add a new column to that table.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZhB4rd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire