move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +1,79 @@
<?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('crm_companies', function (Blueprint $t): void {
$t->id();
$t->string('name');
$t->string('website')->nullable();
$t->string('phone')->nullable();
$t->string('email')->nullable();
$t->string('industry')->nullable();
$t->text('address')->nullable();
$t->text('notes')->nullable();
$t->boolean('is_active')->default(true);
$t->timestamps();
});
Schema::create('crm_contacts', function (Blueprint $t): void {
$t->id();
$t->foreignId('company_id')->nullable()->constrained('crm_companies')->nullOnDelete();
$t->string('first_name');
$t->string('last_name');
$t->string('email')->nullable()->index();
$t->string('phone')->nullable();
$t->string('job_title')->nullable();
$t->text('notes')->nullable();
$t->boolean('is_active')->default(true);
$t->timestamps();
});
Schema::create('crm_leads', function (Blueprint $t): void {
$t->id();
$t->foreignId('contact_id')->nullable()->constrained('crm_contacts')->nullOnDelete();
$t->string('title');
$t->string('source')->nullable();
$t->string('status')->default('new')->index();
$t->decimal('estimated_value', 12, 2)->nullable();
$t->text('notes')->nullable();
$t->timestamp('next_action_at')->nullable();
$t->timestamps();
});
Schema::create('crm_opportunities', function (Blueprint $t): void {
$t->id();
$t->foreignId('company_id')->nullable()->constrained('crm_companies')->nullOnDelete();
$t->foreignId('contact_id')->nullable()->constrained('crm_contacts')->nullOnDelete();
$t->string('name');
$t->string('stage')->default('qualification')->index();
$t->decimal('value', 12, 2)->default(0);
$t->unsignedTinyInteger('probability')->default(0);
$t->date('expected_close_at')->nullable();
$t->text('notes')->nullable();
$t->timestamps();
});
Schema::create('crm_activities', function (Blueprint $t): void {
$t->id();
$t->nullableMorphs('subject');
$t->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$t->string('type');
$t->string('title');
$t->text('description')->nullable();
$t->timestamp('due_at')->nullable();
$t->timestamp('completed_at')->nullable();
$t->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('crm_activities');
Schema::dropIfExists('crm_opportunities');
Schema::dropIfExists('crm_leads');
Schema::dropIfExists('crm_contacts');
Schema::dropIfExists('crm_companies');
}
};