for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateInventoryStocksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
Schema::create('inventory_stocks', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('warehouse_id');
$table->unsignedBigInteger('product_sku_id');
$table->integer('quantity')->default(0);
$table->string('aisle')->nullable();
$table->string('row')->nullable();
$table->timestamps();
$table->foreign('product_sku_id')
->references('id')
->on('product_skus')
->onDelete('cascade');
$table->foreign('warehouse_id')
->on('warehouses')
$table->unique(['product_sku_id', 'warehouse_id'], 'product_warehouse_key');
});
}
* Reverse the migrations.
public function down()
Schema::dropIfExists('inventory_stocks');