Only try to create the licenses table if it doesn't exist

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-01-07 15:43:34 -08:00
parent 359b22e17a
commit 8719b3d3e9
2 changed files with 21 additions and 35 deletions

View file

@ -7,29 +7,14 @@ class CreateTempLicensesTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
* *
* This migration is overwritten by a later migration - 2013_11_25_recreate_licenses_table.php
*
* @return void * @return void
*/ */
public function up() public function up()
{ {
if (!Schema::hasTable('licenses')) { //
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';
});
}
} }
@ -41,6 +26,6 @@ class CreateTempLicensesTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::dropIfExists('licenses'); // Schema::dropIfExists('licenses');
} }
} }

View file

@ -11,7 +11,7 @@ class ReCreateLicensesTable extends Migration
*/ */
public function up() public function up()
{ {
// if (!Schema::hasTable('licenses')) {
Schema::create('licenses', function ($table) { Schema::create('licenses', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
@ -28,6 +28,7 @@ class ReCreateLicensesTable extends Migration
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
}); });
} }
}
/** /**
* Reverse the migrations. * Reverse the migrations.