85 - Add auto_approve column to routes table

This commit is contained in:
myrmidex 2026-03-18 15:28:01 +01:00
parent b832d6d850
commit 2a5a8c788b
3 changed files with 26 additions and 1 deletions

View file

@ -14,6 +14,7 @@
* @property int $platform_channel_id * @property int $platform_channel_id
* @property bool $is_active * @property bool $is_active
* @property int $priority * @property int $priority
* @property bool|null $auto_approve
* @property Carbon $created_at * @property Carbon $created_at
* @property Carbon $updated_at * @property Carbon $updated_at
*/ */
@ -34,10 +35,12 @@ class Route extends Model
'platform_channel_id', 'platform_channel_id',
'is_active', 'is_active',
'priority', 'priority',
'auto_approve',
]; ];
protected $casts = [ protected $casts = [
'is_active' => 'boolean', 'is_active' => 'boolean',
'auto_approve' => 'boolean',
]; ];
/** /**

View file

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('routes', function (Blueprint $table) {
$table->boolean('auto_approve')->nullable()->after('priority');
});
}
public function down(): void
{
Schema::table('routes', function (Blueprint $table) {
$table->dropColumn('auto_approve');
});
}
};

View file

@ -15,7 +15,7 @@ class RouteTest extends TestCase
public function test_fillable_fields(): void public function test_fillable_fields(): void
{ {
$fillableFields = ['feed_id', 'platform_channel_id', 'is_active', 'priority']; $fillableFields = ['feed_id', 'platform_channel_id', 'is_active', 'priority', 'auto_approve'];
$route = new Route; $route = new Route;
$this->assertEquals($fillableFields, $route->getFillable()); $this->assertEquals($fillableFields, $route->getFillable());