File: /var/www/ipsremont-demo/database/migrations/2020_12_12_191302_create_parts_storages_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePartsStoragesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('parts_storage', function (Blueprint $table) {
$table->id();
$table->integer('part_id')->comment('id детали, parts');
$table->integer('warehouse_id')->comment('id склада');
$table->integer('amount')->comment('количество');
$table->string('type')->comment('склад сервиса или подразделения');
$table->timestamp('created_at')->nullable()->useCurrent();
$table->timestamp('updated_at')->nullable()->useCurrent();
$table->index(['part_id', 'warehouse_id', 'type'], 'part_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('parts_storages');
}
}