feat: 데모 URL 관리 시스템 마이그레이션 및 시더 추가
- users 테이블에 role, is_active 필드 추가 - prospects 테이블 생성 (업체 정보) - demo_links 테이블 생성 (토큰 관리) - DemoSystemSeeder 추가 (Ops/Sales 계정, 샘플 데이터)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?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::table('users', function (Blueprint $table) {
|
||||
$table->enum('role', ['sales', 'ops'])->default('sales')->after('email');
|
||||
$table->boolean('is_active')->default(true)->after('role');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['role', 'is_active']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('prospects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('sales_user_id')->constrained('users')->onDelete('cascade');
|
||||
$table->string('company_name', 100);
|
||||
$table->string('contact_person', 100)->nullable();
|
||||
$table->string('email', 100)->nullable();
|
||||
$table->string('phone', 20)->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('sales_user_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('prospects');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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('demo_links', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('prospect_id')->constrained('prospects')->onDelete('cascade');
|
||||
$table->foreignId('created_by')->constrained('users')->onDelete('cascade');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->enum('status', ['active', 'expired', 'revoked'])->default('active');
|
||||
$table->timestamp('expires_at');
|
||||
$table->unsignedInteger('visit_count')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['token', 'status']);
|
||||
$table->index('prospect_id');
|
||||
$table->index('created_by');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('demo_links');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user