Files
mareike/database/migrations/2026_02_14_140010_create_events.php

103 lines
4.3 KiB
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('participation_fee_types', function (Blueprint $table) {
$table->string('slug')->primary();
$table->string('name');
$table->timestamps();
});
Schema::create('participation_types', function (Blueprint $table) {
$table->string('slug')->primary();
$table->string('name');
$table->timestamps();
});
Schema::create('event_participation_fees', function (Blueprint $table) {
$table->id();
$table->string('tenant');
$table->string('type');
$table->string('name');
$table->string('description')->default('');
$table->float('amount',2);
$table->timestamps();
$table->foreign('type')->references('slug')->on('participation_types')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
});
Schema::create('events', function (Blueprint $table) {
$table->id();
$table->string('tenant');
$table->foreignId('cost_unit_id')->nullable()->constrained('cost_units', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->string('name');
$table->string('location');
$table->string('postal_code');
$table->string('email');
$table->dateTime('start_date');
$table->dateTime('end_date');
$table->dateTime('early_bird_end');
$table->dateTime('registration_final_end');
$table->integer('early_bird_end_amount_increase');
$table->string('account_owner');
$table->string('account_iban');
$table->boolean('registration_allowed')->default(false);
$table->string('participation_fee_type');
$table->float('total_max_amount', 2)->default(0);
$table->string('registration_link')->nullable();
$table->boolean('pay_per_day');
$table->boolean('pay_direct');
$table->boolean('send_weekly_report')->default(true);
$table->foreignId('participation_fee_1')->nullable()->constrained('event_participation_fees', 'id')->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('participation_fee_2')->nullable()->constrained('event_participation_fees', 'id')->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('participation_fee_3')->nullable()->constrained('event_participation_fees', 'id')->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('participation_fee_4')->nullable()->constrained('event_participation_fees', 'id')->nullOnDelete()->cascadeOnUpdate();
$table->float('support_per_person', 2)->default(0);
$table->float('support_flat', 2)->default(0);
$table->integer('alcoholics_age')->default(16);
$table->boolean('archived')->default(false);
$table->timestamps();
$table->foreign('tenant')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('participation_fee_type')->references('slug')->on('participation_fee_types')->cascadeOnDelete()->cascadeOnUpdate();
});
Schema::create('event_allowed_eating_habits', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('eating_habit_id')->constrained('eating_habits', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
Schema::create('event_managers', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->string('user_id')->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('cron_tasks');
Schema::dropIfExists('cron_task_types');
}
};