Files
mareike/database/migrations/2026_02_01_140010_create_cron_tasks.php

36 lines
1003 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cron_task_types', function (Blueprint $table) {
$table->string('slug')->primary();
});
Schema::create('cron_tasks', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('execution_type');
$table->time('schedule_time')->nullable();
$table->timestamp('last_run')->nullable();
$table->timestamps();
$table->foreign('execution_type')->references('slug')->on('cron_task_types')->cascadeOnDelete()->cascadeOnUpdate();
});
}
public function down(): void
{
Schema::dropIfExists('cron_tasks');
Schema::dropIfExists('cron_task_types');
}
};