File: /home/armgroup/libs/database/migrations/2021_08_15_134238_create_scores_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateScoresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('scores', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained()->onUpdate('cascade')->onDelete('cascade');
$table->unsignedBigInteger('scorable_id');
$table->string('scorable_type');
$table->unsignedTinyInteger('score');
$table->text('items')->nullable()->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('scores');
}
}