Files
RelaisSMS/database/migrations/2026_06_11_010000_create_contacts_table.php

36 lines
1.1 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('contacts', function (Blueprint $table) {
$table->id();
$table->string('source')->default('local')->index();
$table->string('external_id')->nullable();
$table->string('first_name')->nullable();
$table->string('last_name');
$table->string('organization')->nullable();
$table->string('email')->nullable();
$table->text('notes')->nullable();
$table->boolean('sms_opt_out')->default(false)->index();
$table->boolean('is_favorite')->default(false)->index();
$table->timestamp('synced_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unique(['source', 'external_id']);
$table->index(['last_name', 'first_name']);
});
}
public function down(): void
{
Schema::dropIfExists('contacts');
}
};