fix: installer_completed=true 환경에서 테이블 존재 여부 우회 버그 수정#41
Open
GyusoonKim wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
01. 버그 수정: 신규 서버 배포 시 테이블 not found 오류
문제
INSTALLER_COMPLETED=true 상태에서 신규 서버에 배포 시
migrate 실행 전 부팅 단계에서 g7_modules, g7_plugins,
g7_templates, language_packs 테이블이 없다는 오류 발생.
원인
isExtensionTableReady() 메서드가 installer_completed=true이면
Schema::hasTable() 체크를 건너뛰고 바로 true를 반환.
마이그레이션 전 상태에서 테이블이 없어도 쿼리를 실행하여 오류 발생.
수정 내용
영향 범위
CachesModuleStatus, CachesPluginStatus, CachesTemplateStatus,
ModuleRouteServiceProvider, PluginRouteServiceProvider,
LanguagePackServiceProvider
02. 버그 수정: MySQL read/write 분리 설정의 폴백 누락
문제
config/database.php의 MySQL read/write 분리 설정에서DB_READ_DATABASE,DB_WRITE_DATABASE환경변수가 없을 때DB_DATABASE로 폴백되지 않아 DB 연결 실패 발생.username, password도 동일하게 폴백 누락.
재현 방법
.env에 DB_READ_, DB_WRITE_ 없이 DB_DATABASE만 설정하면
php artisan migrate실행 시 root/laravel DB로 연결 시도하여Access denied 오류 발생.
원인 (수정 전)
'read' => [
'host' => [env('DB_READ_HOST', env('DB_HOST', '127.0.0.1'))],
'database' => env('DB_READ_DATABASE', 'laravel'), // ← DB_DATABASE 폴백 없음
'username' => env('DB_READ_USERNAME', 'root'), // ← DB_USERNAME 폴백 없음
'password' => env('DB_READ_PASSWORD', ''), // ← DB_PASSWORD 폴백 없음
],
수정 후
'read' => [
'host' => [env('DB_READ_HOST', env('DB_HOST', '127.0.0.1'))],
'database' => env('DB_READ_DATABASE', env('DB_DATABASE', 'laravel')),
'username' => env('DB_READ_USERNAME', env('DB_USERNAME', 'root')),
'password' => env('DB_READ_PASSWORD', env('DB_PASSWORD', '')),
],
'write' => [
'host' => [env('DB_WRITE_HOST', env('DB_HOST', '127.0.0.1'))],
'database' => env('DB_WRITE_DATABASE', env('DB_DATABASE', 'laravel')),
'username' => env('DB_WRITE_USERNAME', env('DB_USERNAME', 'root')),
'password' => env('DB_WRITE_PASSWORD', env('DB_PASSWORD', '')),
],
영향 범위
(대부분의 G7 사용자가 해당)
DB 연결이 정상 동작하지 않는 치명적 버그
참고
Laravel 공식 문서의 read/write 분리 설정도
공통 값은 폴백 체인을 권장합니다.
https://laravel.com/docs/database#read-write-connections