mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge pull request #10902 from snipe/fixes/added_primary_key_to_custom_fields_pivot
Fixed #10892 - MySQL 8 compatibilty requires primary key
This commit is contained in:
commit
87fc856361
|
@ -14,13 +14,14 @@ class CreateCustomFieldCustomFieldset extends Migration {
|
||||||
{
|
{
|
||||||
Schema::create('custom_field_custom_fieldset', function(Blueprint $table)
|
Schema::create('custom_field_custom_fieldset', function(Blueprint $table)
|
||||||
{
|
{
|
||||||
|
$table->bigIncrements('id')->first();
|
||||||
$table->integer('custom_field_id');
|
$table->integer('custom_field_id');
|
||||||
$table->integer('custom_fieldset_id');
|
$table->integer('custom_fieldset_id');
|
||||||
|
|
||||||
$table->integer('order');
|
$table->integer('order');
|
||||||
$table->boolean('required');
|
$table->boolean('required');
|
||||||
$table->engine = 'InnoDB';
|
$table->engine = 'InnoDB';
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddPrimaryKeyToCustomFieldsPivot extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Check if the ID primary key already exists, if not, add it
|
||||||
|
Schema::table('custom_field_custom_fieldset', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('custom_field_custom_fieldset', 'id')) {
|
||||||
|
$table->bigIncrements('id')->first();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('custom_field_custom_fieldset', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('custom_field_custom_fieldset', 'id')) {
|
||||||
|
$table->dropColumn('id');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue