v7.0.0-beta.2 release

This commit is contained in:
HeuJung committed 2026-04-20 20:37:49 +09:00
1 parent 6595fd0eb5
commit fa8eba7a0d
1165 files changed
+107118 -762127

No files matched your search

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 알림 정의 테이블 생성.
*
* @return void
*/
public function up(): void
{
Schema::create('notification_definitions', function (Blueprint $table) {
$table->id()->comment('ID');
$table->string('type', 100)->unique()->comment('알림 타입 (welcome, order_confirmed 등)');
$table->string('hook_prefix', 100)->comment('훅 접두사 (core.auth, sirsoft-ecommerce 등)');
$table->string('extension_type', 20)->comment('확장 타입: core, module, plugin');
$table->string('extension_identifier', 100)->comment('확장 식별자: core, sirsoft-board 등');
$table->text('name')->comment('다국어 이름 ({"ko": "회원가입 환영", "en": "Welcome"})');
$table->mediumText('description')->nullable()->comment('다국어 설명');
$table->text('variables')->nullable()->comment('사용 가능 변수 메타데이터 ([{key, description}])');
$table->text('channels')->comment('활성 채널 (["mail", "database"])');
$table->text('hooks')->comment('트리거 훅 목록 (["core.auth.after_register"])');
$table->boolean('is_active')->default(true)->comment('활성 여부');
$table->boolean('is_default')->default(true)->comment('시더 생성 여부');
$table->timestamps();
});
}
/**
* 알림 정의 테이블 삭제.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists('notification_definitions');
}
};
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 알림 템플릿 테이블 생성.
*
* @return void
*/
public function up(): void
{
Schema::create('notification_templates', function (Blueprint $table) {
$table->id()->comment('ID');
$table->foreignId('definition_id')->constrained('notification_definitions')->cascadeOnDelete()->comment('알림 정의 ID');
$table->string('channel', 50)->comment('채널: mail, database, fcm');
$table->text('subject')->nullable()->comment('다국어 제목 ({"ko": "...", "en": "..."})');
$table->mediumText('body')->comment('다국어 본문 ({"ko": "...", "en": "..."})');
$table->boolean('is_active')->default(true)->comment('해당 채널 활성 여부');
$table->boolean('is_default')->default(true)->comment('시더 생성 여부');
$table->text('user_overrides')->nullable()->comment('사용자가 수정한 필드명 목록');
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete()->comment('수정자');
$table->timestamps();
$table->unique(['definition_id', 'channel']);
});
}
/**
* 알림 템플릿 테이블 삭제.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists('notification_templates');
}
};
@@ -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
{
/**
* 사이트내 알림 테이블 생성 (Laravel 표준).
*
* @return void
*/
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary()->comment('UUID');
$table->string('type')->comment('알림 클래스명');
$table->string('notifiable_type')->comment('알림 수신 모델 타입');
$table->unsignedBigInteger('notifiable_id')->comment('알림 수신 모델 ID');
$table->index(['notifiable_type', 'notifiable_id']);
$table->text('data')->comment('알림 데이터 (JSON)');
$table->timestamp('read_at')->nullable()->comment('읽음 시각');
$table->timestamps();
});
}
/**
* 사이트내 알림 테이블 삭제.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists('notifications');
}
};
@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 알림 발송 이력 테이블 생성.
*
* @return void
*/
public function up(): void
{
Schema::create('notification_logs', function (Blueprint $table) {
$table->id()->comment('ID');
$table->string('channel', 50)->comment('채널: mail, database, fcm 등');
$table->string('notification_type', 100)->comment('알림 타입: welcome, order_confirmed 등');
$table->string('extension_type', 20)->default('core')->comment('확장 타입: core, module, plugin');
$table->string('extension_identifier', 100)->default('core')->comment('확장 식별자');
$table->foreignId('recipient_user_id')->nullable()->constrained('users')->nullOnDelete()
->comment('수신자 회원 ID (회원인 경우)');
$table->string('recipient_identifier', 255)->comment('수신자 식별자 (채널별: 이메일, 디바이스토큰, user_id 등)');
$table->string('recipient_name', 255)->nullable()->comment('수신자 표시명 (발송 시점 스냅샷)');
$table->foreignId('sender_user_id')->nullable()->constrained('users')->nullOnDelete()
->comment('발송자 회원 ID (null=시스템 자동)');
$table->string('subject', 500)->nullable()->comment('렌더링된 제목');
$table->longText('body')->nullable()->comment('렌더링된 본문');
$table->string('status', 20)->default('sent')->comment('상태: sent, failed, skipped');
$table->text('error_message')->nullable()->comment('에러 메시지');
$table->string('source', 100)->nullable()->comment('발송 출처: notification, test_mail 등');
$table->timestamp('sent_at')->useCurrent()->comment('발송 시각');
$table->timestamps();
$table->index('channel', 'idx_notification_logs_channel');
$table->index('notification_type', 'idx_notification_logs_type');
$table->index('status', 'idx_notification_logs_status');
$table->index('sent_at', 'idx_notification_logs_sent_at');
$table->index('recipient_user_id', 'idx_notification_logs_recipient_user');
$table->index('recipient_identifier', 'idx_notification_logs_recipient_id');
$table->index(['extension_type', 'extension_identifier'], 'idx_notification_logs_extension');
});
}
/**
* 알림 발송 이력 테이블 삭제.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists('notification_logs');
}
};
@@ -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
{
/**
* 알림 템플릿에 click_url 컬럼 추가.
*
* 알림센터에서 알림 클릭 시 이동할 URL 패턴을 저장합니다.
* 변수 플레이스홀더 사용 가능 (예: /mypage/orders/{order_number}).
* nullable — 미정의 시 프론트엔드 fallback 경로 사용.
*/
public function up(): void
{
Schema::table('notification_templates', function (Blueprint $table) {
$table->string('click_url', 500)
->nullable()
->after('body')
->comment('알림 클릭 시 이동 URL 패턴 (변수 치환 가능, 예: /mypage/orders/{order_number})');
});
}
/**
* click_url 컬럼 제거.
*/
public function down(): void
{
Schema::table('notification_templates', function (Blueprint $table) {
if (Schema::hasColumn('notification_templates', 'click_url')) {
$table->dropColumn('click_url');
}
});
}
};
@@ -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
{
/**
* 알림 템플릿에 수신자 규칙 컬럼을 추가합니다.
*
* 채널별 독립 수신자 설정을 위해 templates 레벨에 recipients를 배치합니다.
*/
public function up(): void
{
Schema::table('notification_templates', function (Blueprint $table) {
$table->text('recipients')
->nullable()
->comment('수신자 규칙 JSON ([{type, value, relation, exclude_trigger_user}])')
->after('click_url');
});
}
/**
* 수신자 규칙 컬럼을 제거합니다.
*/
public function down(): void
{
Schema::table('notification_templates', function (Blueprint $table) {
if (Schema::hasColumn('notification_templates', 'recipients')) {
$table->dropColumn('recipients');
}
});
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* notification_definitions 테이블에 user_overrides 컬럼 추가.
*
* 사용자가 수정한 필드명 목록을 JSON 으로 저장하여 시더 재실행 시 보존합니다.
*
* @return void
*/
public function up(): void
{
Schema::table('notification_definitions', function (Blueprint $table) {
$table->text('user_overrides')->nullable()->after('is_default')
->comment('유저가 수정한 필드명 목록 (예: ["name", "is_active"])');
});
}
/**
* user_overrides 컬럼 삭제.
*
* @return void
*/
public function down(): void
{
if (! Schema::hasColumn('notification_definitions', 'user_overrides')) {
return;
}
Schema::table('notification_definitions', function (Blueprint $table) {
$table->dropColumn('user_overrides');
});
}
};
@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* schedules 테이블에 user_overrides 컬럼 추가 (사전 설계).
*
* 현재는 시더 없이 사용자 수동 생성 중심이지만, 향후 코어/모듈이 기본 스케줄
* 시더를 도입하면 syncOrCreateFromUpgrade 호출만 추가하면 됩니다.
*
* @return void
*/
public function up(): void
{
Schema::table('schedules', function (Blueprint $table) {
$table->text('user_overrides')->nullable()->after('is_active')
->comment('유저가 수정한 필드명 목록 (예: ["expression", "command", "timeout"])');
});
}
/**
* user_overrides 컬럼 삭제.
*
* @return void
*/
public function down(): void
{
if (! Schema::hasColumn('schedules', 'user_overrides')) {
return;
}
Schema::table('schedules', function (Blueprint $table) {
$table->dropColumn('user_overrides');
});
}
};
@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 모듈/플러그인 테이블에 vendor_mode 컬럼 추가.
*
* 마지막 설치 시 사용된 vendor 모드(auto/composer/bundled)를 기록하여,
* 업데이트 시 동일 모드를 상속할 수 있도록 합니다.
*/
public function up(): void
{
Schema::table('modules', function (Blueprint $table) {
if (! Schema::hasColumn('modules', 'vendor_mode')) {
$table->string('vendor_mode', 16)
->default('auto')
->after('status')
->comment('Vendor 설치 모드 (auto|composer|bundled)');
}
});
Schema::table('plugins', function (Blueprint $table) {
if (! Schema::hasColumn('plugins', 'vendor_mode')) {
$table->string('vendor_mode', 16)
->default('auto')
->after('status')
->comment('Vendor 설치 모드 (auto|composer|bundled)');
}
});
}
/**
* 마이그레이션 롤백.
*/
public function down(): void
{
Schema::table('modules', function (Blueprint $table) {
if (Schema::hasColumn('modules', 'vendor_mode')) {
$table->dropColumn('vendor_mode');
}
});
Schema::table('plugins', function (Blueprint $table) {
if (Schema::hasColumn('plugins', 'vendor_mode')) {
$table->dropColumn('vendor_mode');
}
});
}
};