mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Check if table exists before trying to create
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
e30d814ece
commit
86a2312a31
|
@ -13,20 +13,22 @@ class CreateCheckoutAcceptancesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('checkout_acceptances', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
if (!Schema::hasTable('checkout_acceptances')) {
|
||||
Schema::create('checkout_acceptances', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
|
||||
$table->morphs('checkoutable');
|
||||
$table->integer('assigned_to_id')->nullable();
|
||||
$table->morphs('checkoutable');
|
||||
$table->integer('assigned_to_id')->nullable();
|
||||
|
||||
$table->string('signature_filename')->nullable();
|
||||
$table->string('signature_filename')->nullable();
|
||||
|
||||
$table->timestamp('accepted_at')->nullable();
|
||||
$table->timestamp('declined_at')->nullable();
|
||||
$table->timestamp('accepted_at')->nullable();
|
||||
$table->timestamp('declined_at')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +38,8 @@ class CreateCheckoutAcceptancesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('checkout_acceptances');
|
||||
if (Schema::hasTable('checkout_acceptances')) {
|
||||
Schema::dropIfExists('checkout_acceptances');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,15 @@ class AddKitsLicensesTable extends Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::create('kits_licenses', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('license_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
if (!Schema::hasTable('kits_licenses')) {
|
||||
Schema::create('kits_licenses', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('license_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,8 +30,9 @@ class AddKitsLicensesTable extends Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::drop('kits_licenses');
|
||||
if (Schema::hasTable('kits_licenses')) {
|
||||
Schema::drop('kits_licenses');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,13 +12,14 @@ class AddKitsTable extends Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::create('kits', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable()->default(NULL);
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
if (!Schema::hasTable('kits')) {
|
||||
Schema::create('kits', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable()->default(NULL);
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,8 +30,9 @@ class AddKitsTable extends Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::drop('kits');
|
||||
if (Schema::hasTable('kits')) {
|
||||
Schema::drop('kits');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,15 @@ class AddKitsModelsTable extends Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::create('kits_models', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('model_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
if (!Schema::hasTable('kits_models')) {
|
||||
Schema::create('kits_models', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('model_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,8 +30,9 @@ class AddKitsModelsTable extends Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::drop('kits_models');
|
||||
if (Schema::hasTable('kits_models')) {
|
||||
Schema::drop('kits_models');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,14 +13,15 @@ class AddKitsConsumablesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::create('kits_consumables', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('consumable_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
if (!Schema::hasTable('kits_consumables')) {
|
||||
Schema::create('kits_consumables', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('consumable_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,8 @@ class AddKitsConsumablesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::drop('kits_consumables');
|
||||
if (Schema::hasTable('kits_consumables')) {
|
||||
Schema::drop('kits_consumables');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,14 +13,15 @@ class AddKitsAccessoriesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::create('kits_accessories', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('accessory_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
if (!Schema::hasTable('kits_accessories')) {
|
||||
Schema::create('kits_accessories', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('kit_id')->nullable()->default(NULL);
|
||||
$table->integer('accessory_id')->nullable()->default(NULL);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,8 @@ class AddKitsAccessoriesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::drop('kits_accessories');
|
||||
if (Schema::hasTable('kits_accessories')) {
|
||||
Schema::drop('kits_accessories');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue