Custom Setup Migrations
Reacterable Model Migration
Automatic setup described in Setup Reacterable.
- Create database migration for storing link between
Reacter
&Reacterable
.
$ php artisan make:migration add_to_users_column_love_reacter_id
- Add
love_reacter_id
column with typeUNSIGNED 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 benullable
:$table->unsignedBigInteger('love_reacter_id')->nullable();
- Run migration.
$ php artisan migrate
Reactable Model Migration
Automatic setup described in Setup Reactable.
- Create database migration for storing link between
Reactant
&Reactable
.
$ php artisan make:migration add_to_comments_column_love_reactant_id
- Add
love_reactant_id
column with typeUNSIGNED 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 benullable
:$table->unsignedBigInteger('love_reactant_id')->nullable();
- Run migration.
$ php artisan migrate
Updated over 4 years ago