kcal/database/migrations/2020_12_21_214128_create_in...

38 lines
933 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateIngredientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ingredients', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->enum('unit', ['tsp', 'tbsp', 'cup'])->nullable();
$table->unsignedFloat('calories')->default(0);
$table->unsignedFloat('protein')->default(0);
$table->unsignedFloat('fat')->default(0);
$table->unsignedFloat('carbohydrates')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ingredients');
}
}