Attempt fix at Laravel "magic" class in migrations resulting in table already exists

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-09-26 15:48:43 -07:00
parent 1657ba396f
commit 6f96b25440
2 changed files with 47 additions and 1 deletions

View file

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateTempLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('licenses', 'id')) {
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('name');
$table->integer('model_id');
$table->text('serial');
$table->string('license_email');
$table->string('license_name');
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number');
$table->integer('assigned_to');
$table->text('notes');
$table->integer('user_id')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('licenses');
}
}

View file

@ -11,7 +11,7 @@ class DropLicensesTable extends Migration
*/
public function up()
{
Schema::drop('licenses');
Schema::dropIfExists('licenses');
}
/**