v7.0.0-beta.1 release
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Upgrades;
|
||||
|
||||
use App\Contracts\Extension\UpgradeStepInterface;
|
||||
use App\Extension\UpgradeContext;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* 코어 7.0.0-alpha.15 업그레이드 스텝
|
||||
*
|
||||
* 기존 사용자 레코드에 UUID v7을 백필하고 NOT NULL 제약을 추가합니다.
|
||||
* 신규 설치 시에는 User 모델 boot() creating 이벤트에서 UUID가 자동 생성되므로
|
||||
* 이 스텝은 기존 운영 DB 업그레이드 시에만 실질적으로 동작합니다.
|
||||
*/
|
||||
class Upgrade_7_0_0_alpha_15 implements UpgradeStepInterface
|
||||
{
|
||||
/**
|
||||
* 업그레이드 스텝을 실행합니다.
|
||||
*
|
||||
* @param UpgradeContext $context 업그레이드 컨텍스트
|
||||
* @return void
|
||||
*/
|
||||
public function run(UpgradeContext $context): void
|
||||
{
|
||||
if (! Schema::hasColumn('users', 'uuid')) {
|
||||
$context->logger->warning('users 테이블에 uuid 컬럼이 없습니다. 마이그레이션을 먼저 실행하세요.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. UUID가 없는 기존 레코드에 백필
|
||||
$nullCount = DB::table('users')->whereNull('uuid')->count();
|
||||
|
||||
if ($nullCount > 0) {
|
||||
$context->logger->info("UUID 백필 시작: {$nullCount}건의 기존 레코드");
|
||||
|
||||
DB::table('users')->whereNull('uuid')->orderBy('id')->chunk(100, function ($users) {
|
||||
foreach ($users as $user) {
|
||||
DB::table('users')
|
||||
->where('id', $user->id)
|
||||
->update(['uuid' => Str::orderedUuid()->toString()]);
|
||||
}
|
||||
});
|
||||
|
||||
$context->logger->info("UUID 백필 완료: {$nullCount}건 처리");
|
||||
} else {
|
||||
$context->logger->info('모든 사용자 레코드에 UUID가 이미 존재합니다.');
|
||||
}
|
||||
|
||||
// 2. NOT NULL 제약 추가 (아직 nullable인 경우)
|
||||
$columnType = DB::selectOne("SHOW COLUMNS FROM {$context->table('users')} WHERE Field = 'uuid'");
|
||||
|
||||
if ($columnType && $columnType->Null === 'YES') {
|
||||
Schema::table('users', function ($table) {
|
||||
$table->uuid('uuid')->nullable(false)->unique()->change();
|
||||
});
|
||||
|
||||
$context->logger->info('uuid 컬럼에 NOT NULL 제약을 추가했습니다.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Upgrades;
|
||||
|
||||
use App\Contracts\Extension\UpgradeStepInterface;
|
||||
use App\Extension\UpgradeContext;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* 코어 7.0.0-alpha.17 업그레이드 스텝
|
||||
*
|
||||
* ActivityLog 시스템 Monolog 리팩토링에 따른 데이터 무결성 확인.
|
||||
* - description 컬럼 삭제 → description_key/description_params 기반 다국어 전환
|
||||
* - changes 컬럼 추가 (구조화된 변경 이력)
|
||||
* - 복합 인덱스 추가
|
||||
* - 기존 로그 데이터는 description_key NULL 상태로 유지 (백필 생략 — PO 결정)
|
||||
*/
|
||||
class Upgrade_7_0_0_alpha_17 implements UpgradeStepInterface
|
||||
{
|
||||
/**
|
||||
* 업그레이드 스텝을 실행합니다.
|
||||
*
|
||||
* @param UpgradeContext $context 업그레이드 컨텍스트
|
||||
* @return void
|
||||
*/
|
||||
public function run(UpgradeContext $context): void
|
||||
{
|
||||
$table = $context->table('activity_logs');
|
||||
|
||||
// 1. 마이그레이션 적용 여부 확인
|
||||
if (Schema::hasColumn('activity_logs', 'description')) {
|
||||
$context->logger->warning(
|
||||
'activity_logs 테이블에 description 컬럼이 아직 존재합니다. 마이그레이션을 먼저 실행하세요.'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('activity_logs', 'description_key')) {
|
||||
$context->logger->warning(
|
||||
'activity_logs 테이블에 description_key 컬럼이 없습니다. 마이그레이션을 먼저 실행하세요.'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 기존 데이터 현황 보고
|
||||
$totalCount = DB::table('activity_logs')->count();
|
||||
$nullKeyCount = DB::table('activity_logs')->whereNull('description_key')->count();
|
||||
$filledKeyCount = $totalCount - $nullKeyCount;
|
||||
|
||||
$context->logger->info("활동 로그 현황: 총 {$totalCount}건 (description_key 설정됨: {$filledKeyCount}건, NULL: {$nullKeyCount}건)");
|
||||
|
||||
if ($nullKeyCount > 0) {
|
||||
$context->logger->info(
|
||||
"기존 {$nullKeyCount}건의 로그는 description_key가 NULL 상태로 유지됩니다. "
|
||||
. '새 로그부터 description_key 기반 다국어가 적용됩니다.'
|
||||
);
|
||||
}
|
||||
|
||||
// 3. loggable NULL 현황 보고
|
||||
$nullLoggableCount = DB::table('activity_logs')
|
||||
->whereNull('loggable_type')
|
||||
->whereNull('loggable_id')
|
||||
->count();
|
||||
|
||||
$context->logger->info("loggable NULL 현황: {$nullLoggableCount}건 (새 로그부터 모델 연결됩니다)");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Upgrades;
|
||||
|
||||
use App\Contracts\Extension\UpgradeStepInterface;
|
||||
use App\Extension\UpgradeContext;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* 코어 7.0.0-alpha.19 업그레이드 스텝
|
||||
*
|
||||
* 검색/필터/정렬 성능 향상을 위한 인덱스 추가 검증.
|
||||
* - activity_logs: description_key 인덱스
|
||||
* - users: created_at 인덱스
|
||||
* - mail_send_logs: status 인덱스
|
||||
* - template_layouts: template_id 인덱스
|
||||
* - schedules: created_at 인덱스
|
||||
*/
|
||||
class Upgrade_7_0_0_alpha_19 implements UpgradeStepInterface
|
||||
{
|
||||
/**
|
||||
* 검증 대상 인덱스 목록.
|
||||
*
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private const EXPECTED_INDEXES = [
|
||||
'activity_logs' => ['idx_activity_logs_description_key'],
|
||||
'users' => ['idx_users_created_at'],
|
||||
'mail_send_logs' => ['idx_mail_send_logs_status'],
|
||||
'template_layouts' => ['idx_template_layouts_template_id'],
|
||||
'schedules' => ['idx_schedules_created_at'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 업그레이드 스텝을 실행합니다.
|
||||
*
|
||||
* @param UpgradeContext $context 업그레이드 컨텍스트
|
||||
*/
|
||||
public function run(UpgradeContext $context): void
|
||||
{
|
||||
$totalExpected = 0;
|
||||
$totalFound = 0;
|
||||
|
||||
foreach (self::EXPECTED_INDEXES as $table => $indexes) {
|
||||
if (! Schema::hasTable($table)) {
|
||||
$context->logger->warning("[alpha.19] {$table} 테이블이 존재하지 않습니다.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$existingIndexes = collect(Schema::getIndexes($table))->pluck('name')->toArray();
|
||||
|
||||
foreach ($indexes as $indexName) {
|
||||
$totalExpected++;
|
||||
|
||||
if (in_array($indexName, $existingIndexes)) {
|
||||
$totalFound++;
|
||||
} else {
|
||||
$context->logger->warning("[alpha.19] {$table} 테이블에 {$indexName} 인덱스가 없습니다. 마이그레이션을 실행하세요.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$context->logger->info("[alpha.19] 코어 인덱스 검증 완료: {$totalFound}/{$totalExpected}개 확인됨");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Upgrades;
|
||||
|
||||
use App\Contracts\Extension\UpgradeStepInterface;
|
||||
use App\Extension\UpgradeContext;
|
||||
|
||||
/**
|
||||
* 코어 7.0.0-alpha.20 업그레이드 스텝
|
||||
*
|
||||
* Laravel Scout 통합 및 FULLTEXT 검색엔진 드라이버 확장 시스템 도입.
|
||||
* scout.php 설정 파일 존재 여부를 검증합니다.
|
||||
*/
|
||||
class Upgrade_7_0_0_alpha_20 implements UpgradeStepInterface
|
||||
{
|
||||
/**
|
||||
* 업그레이드 스텝을 실행합니다.
|
||||
*
|
||||
* @param UpgradeContext $context 업그레이드 컨텍스트
|
||||
* @return void
|
||||
*/
|
||||
public function run(UpgradeContext $context): void
|
||||
{
|
||||
// Scout 설정 파일 존재 확인
|
||||
if (file_exists(config_path('scout.php'))) {
|
||||
$context->logger->info('[alpha.20] config/scout.php 설정 파일 확인됨');
|
||||
} else {
|
||||
$context->logger->warning('[alpha.20] config/scout.php 설정 파일이 없습니다. 코어 업데이트 후 확인하세요.');
|
||||
}
|
||||
|
||||
// Scout 드라이버 설정 확인
|
||||
$driver = config('scout.driver', 'mysql-fulltext');
|
||||
$context->logger->info("[alpha.20] 검색 엔진 드라이버: {$driver}");
|
||||
|
||||
$context->logger->info('[alpha.20] Laravel Scout + FULLTEXT 검색엔진 확장 시스템 도입 완료');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Upgrades;
|
||||
|
||||
use App\Contracts\Extension\UpgradeStepInterface;
|
||||
use App\Extension\UpgradeContext;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* 코어 7.0.0-alpha.4 업그레이드 스텝
|
||||
*
|
||||
* core_upgrade_test 테이블에 샘플 데이터를 삽입합니다.
|
||||
* 코어 업데이트 시 업그레이드 스텝이 정상 실행되는지 검증하기 위한 테스트 스텝입니다.
|
||||
*/
|
||||
class Upgrade_7_0_0_alpha_4 implements UpgradeStepInterface
|
||||
{
|
||||
/**
|
||||
* 업그레이드 스텝을 실행합니다.
|
||||
*
|
||||
* @param UpgradeContext $context 업그레이드 컨텍스트
|
||||
* @return void
|
||||
*/
|
||||
public function run(UpgradeContext $context): void
|
||||
{
|
||||
// 완료됨 — core_upgrade_test 테이블은 테스트 전용이므로 더 이상 실행하지 않음
|
||||
// $context->logger->info("코어 업그레이드 스텝 7.0.0-alpha.4 실행: core_upgrade_test 샘플 데이터 삽입");
|
||||
//
|
||||
// if (! Schema::hasTable('core_upgrade_test')) {
|
||||
// $context->logger->warning("core_upgrade_test 테이블이 존재하지 않습니다. 마이그레이션을 먼저 실행하세요.");
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// DB::table('core_upgrade_test')->insert([
|
||||
// 'name' => 'upgrade_step_test',
|
||||
// 'description' => "코어 업그레이드 스텝 검증용 샘플 데이터 (from: {$context->fromVersion} → to: {$context->toVersion})",
|
||||
// 'created_at' => now(),
|
||||
// 'updated_at' => now(),
|
||||
// ]);
|
||||
//
|
||||
// $context->logger->info("코어 업그레이드 스텝 7.0.0-alpha.4 완료: 샘플 데이터 1건 삽입");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user