Check for password_resets table in migration

This commit is contained in:
Ryan Scherler
2020-03-11 17:35:50 -07:00
parent 3867aa9fe6
commit ccc3bdfe03
2 changed files with 16 additions and 7 deletions
@@ -6,6 +6,13 @@ use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* The name of the table for the migration.
*
* @var string
*/
protected $tableName = 'password_resets';
/**
* Run the migrations.
*
@@ -13,11 +20,13 @@ class CreatePasswordResetsTable extends Migration
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
if (!Schema::hasTable($this->tableName)) {
Schema::create($this->tableName, function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
}
/**
@@ -27,6 +36,6 @@ class CreatePasswordResetsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('password_resets');
Schema::dropIfExists($this->tableName);
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ class AlpineServiceProvider extends ServiceProvider
*
* @var string
*/
protected $packagePath = __DIR__ . '/../';
protected $packagePath = __DIR__.'/../';
/**
* Register bindings in the container.