Files
bandtoolv2/database/migrations/2025_10_17_043346_bewerbung.php
T
2025-10-17 08:08:34 +02:00

45 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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');
}
};