<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserBenchmarkLinesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_benchmark_lines', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger("user_benchmark_section_id");
            $table->unsignedBigInteger("training_workout_line_id");
            $table->float("val")->nullable();
            $table->string("units",50)->nullable();
            $table->unsignedInteger("reps")->nullable();
            $table->timestamps();

            $table->foreign("training_workout_line_id")->on("training_workout_lines")->references("id")->onDelete("restrict");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_benchmark_lines');
    }
}
