Files
laraundfelix/database/migrations/0001_01_01_000000_create_users_table.php
T
LarsandCursor 2035c46edd
Deploy Test / test (push) Successful in 2m25s
Deploy Test / deploy (push) Failing after 25s
Stelle das U0-Fundament mit CMS, Mitgliedern und Filament bereit.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 08:32:14 +01:00

76 lines
2.7 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('parties', function (Blueprint $table) {
$table->id();
$table->string('type');
$table->string('display_name');
$table->timestamps();
});
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->foreignId('party_id')->nullable()->constrained('parties')->nullOnDelete();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('status')->default('aktiv');
$table->timestamp('confirmed_adult_at')->nullable();
$table->text('app_authentication_secret')->nullable();
$table->text('app_authentication_recovery_codes')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('profiles', function (Blueprint $table) {
$table->id();
$table->foreignId('party_id')->unique()->constrained('parties')->cascadeOnDelete();
$table->string('display_name')->nullable();
$table->json('visibility');
$table->timestamps();
});
Schema::create('staff_role_assignments', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('role');
$table->timestamps();
$table->unique(['user_id', 'role']);
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
public function down(): void
{
Schema::dropIfExists('sessions');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('staff_role_assignments');
Schema::dropIfExists('profiles');
Schema::dropIfExists('users');
Schema::dropIfExists('parties');
}
};