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

@ -6,30 +6,15 @@ 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,22 +11,23 @@ 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');
$table->string('serial'); $table->string('serial');
$table->date('purchase_date')->nullable(); $table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable(); $table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number'); $table->string('order_number');
$table->integer('seats'); $table->integer('seats');
$table->text('notes'); $table->text('notes');
$table->integer('user_id')->nullable(); $table->integer('user_id')->nullable();
$table->integer('depreciation_id'); $table->integer('depreciation_id');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
}); });
}
} }
/** /**