While migration to db you often face/might face this error which says the table name that you wrote is already exists in the database. so in that case one of the solutions that you can try is wrapping up your create schema with this:
if(!Schema::hasTable('users')){
}
Example:
Example:
if(!Schema::hasTable('users')){
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('role_id')->unsigned()->nullable();
$table->foreign('role_id')->references('id')->on('roles')
->onDelete('set null');
$table->timestamps();
});
}
Comments
Post a Comment