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 CreateProductItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
Schema::create('product_items', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('product_id')->nullable();
$table->unsignedBigInteger('category_id')->nullable();
$table->text('image')->nullable();
$table->string('name')->nullable();
$table->string('description')->nullable();
$table->decimal('price');
$table->integer('quantity')->nullable();
$table->timestamps();
//foreign
$table->foreign('product_id')->references('id')->on('products');
$table->foreign('category_id')->references('id')->on('categories');
});
}
* Reverse the migrations.
public function down()
Schema::dropIfExists('product_items');