Custom Setup Migrations

Reacterable Model Migration

📘

Automatic setup described in Setup Reacterable.

  1. Create database migration for storing link between Reacter & Reacterable.
$ php artisan make:migration add_to_users_column_love_reacter_id
  1. Add love_reacter_id column with type UNSIGNED BIGINT to new migration.
<?php

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

class AddToUsersColumnLoveReacterId extends Migration
{
    public function up(): void
    {
         Schema::table('users', function (Blueprint $table) {
             $table->unsignedBigInteger('love_reacter_id');
         });
    }
}

📘

love_reacter_id column could be nullable:

$table->unsignedBigInteger('love_reacter_id')->nullable();
  1. Run migration.
$ php artisan migrate

Reactable Model Migration

📘

Automatic setup described in Setup Reactable.

  1. Create database migration for storing link between Reactant & Reactable.
$ php artisan make:migration add_to_comments_column_love_reactant_id
  1. Add love_reactant_id column with type UNSIGNED BIGINT to new migration.
<?php

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

class AddToUsersColumnLoveReactantId extends Migration
{
    public function up(): void
    {
         Schema::table('comments', function (Blueprint $table) {
             $table->unsignedBigInteger('love_reactant_id');
         });
    }
}

📘

love_reactant_id column could be nullable:

$table->unsignedBigInteger('love_reactant_id')->nullable();
  1. Run migration.
$ php artisan migrate