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_idcolumn with typeUNSIGNED BIGINTto 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_idcolumn 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_idcolumn with typeUNSIGNED BIGINTto 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_idcolumn could benullable:$table->unsignedBigInteger('love_reactant_id')->nullable();
- Run migration.
$ php artisan migrate
Updated almost 6 years ago
