for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of Laravel Love.
*
* (c) Anton Komarev <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
use Cog\Laravel\Love\Reactant\ReactionCounter\Models\ReactionCounter;
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;
return new class extends Migration
{
/**
* Run the migrations.
public function up(): void
$this->schema->create((new ReactionCounter())->getTable(), function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('reactant_id');
$table->unsignedBigInteger('reaction_type_id');
$table->unsignedBigInteger('count');
$table->decimal('weight', 13, 2);
$table->timestamps();
$table->index([
'reactant_id',
'reaction_type_id',
], 'love_reactant_reaction_counters_reactant_reaction_type_index');
$table
->foreign('reactant_id')
->references('id')
->on('love_reactants')
->onDelete('cascade');
->foreign('reaction_type_id')
->on('love_reaction_types')
});
}
* Reverse the migrations.
public function down(): void
$this->schema->dropIfExists((new ReactionCounter())->getTable());
};