Public Access
45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?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::create('bewerbungen', function (Blueprint $table) {
|
||
$table->id();
|
||
|
||
// Basisdaten
|
||
$table->string('name', 255);
|
||
$table->text('text'); // Bewerbungstext ist i.d.R. länger als 255
|
||
|
||
// Dateien (optional) – Pfade in /storage/app/public/...
|
||
$table->string('pic_path', 2048)->nullable();
|
||
$table->string('bedingungen_path', 2048)->nullable();
|
||
|
||
// Status & Zeitsteuerung
|
||
$table->boolean('active')->default(true)->index(); // "aktiv" -> lieber englisch/konsequent
|
||
$table->boolean('timed')->default(false)->index(); // ob zeitgesteuert
|
||
|
||
// Zeitraum (optional, wenn timed = true)
|
||
$table->timestamp('start_at')->nullable()->index();
|
||
$table->timestamp('end_at')->nullable()->index();
|
||
|
||
$table->timestampsTz();
|
||
$table->softDeletesTz();
|
||
});
|
||
|
||
// OPTIONAL: DB-Check (MySQL 8+/Postgres) – nur wenn deine DB & Laravel-Version das unterstützen
|
||
// Schema::table('bewerbungen', function (Blueprint $table) {
|
||
// $table->check('(end_at IS NULL OR start_at IS NULL OR end_at >= start_at)');
|
||
// });
|
||
}
|
||
|
||
public function down(): void
|
||
{
|
||
Schema::dropIfExists('bewerbungen');
|
||
}
|
||
};
|