promoseven-group/database/migrations/2026_01_28_112047_create_guests_table.php
2026-01-29 17:12:02 +03:00

49 lines
1.7 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('guests', function (Blueprint $table) {
$table->id();
$table->string('loyalty_id')->unique();
$table->string('first_name');
$table->string('last_name');
$table->string('email')->nullable();
$table->string('phone')->nullable();
$table->date('date_of_birth')->nullable();
$table->enum('gender', ['male', 'female', 'other'])->nullable();
$table->string('nationality')->nullable();
$table->text('address')->nullable();
$table->string('passport_number')->nullable();
$table->date('passport_expiry')->nullable();
$table->string('preferred_language')->default('en');
$table->json('preferences')->nullable();
$table->foreignId('loyalty_tier_id')->nullable()->constrained()->onDelete('set null');
$table->integer('total_points')->default(0);
$table->decimal('total_spend', 12, 2)->default(0);
$table->integer('visit_count')->default(0);
$table->datetime('last_visit_at')->nullable();
$table->datetime('first_visit_at')->nullable();
$table->enum('status', ['active', 'inactive', 'blacklisted'])->default('active');
$table->text('notes')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('guests');
}
};