## 잠금 기능 (Lock Feature) - entity_relationships 테이블에 is_locked, locked_by, locked_at 컬럼 추가 - EntityRelationship 모델에 잠금 관련 헬퍼 메서드 추가 - LockCheckTrait 생성 (destroy 시 잠금 체크 공통 로직) - 각 Service의 destroy() 메서드에 잠금 체크 적용 - API 응답에 is_locked 필드 포함 - 한국어 에러 메시지 추가 ## FK 레거시 코드 정리 - ItemMasterSeeder: entity_relationships 기반으로 전환 - ItemPage 모델: FK 기반 sections() 관계 제거 - ItemSectionService: clone() 메서드 FK 제거 - SectionTemplateService: page_id 컬럼 참조 제거 - EntityRelationship::link() 파라미터 순서 통일 ## 기타 - Swagger 스키마에 is_locked 속성 추가 - 프론트엔드 가이드 문서 추가
10 KiB
논리적 데이터베이스 관계 문서
자동 생성: 2025-11-27 15:34:54 소스: Eloquent 모델 관계 분석
📊 모델별 관계 현황
boards
모델: App\Models\Boards\Board
- customFields(): hasMany →
board_settings - posts(): hasMany →
posts
board_comments
모델: App\Models\Boards\BoardComment
- post(): belongsTo →
posts - user(): belongsTo →
users - parent(): belongsTo →
board_comments - children(): hasMany →
board_comments
board_settings
모델: App\Models\Boards\BoardSetting
- board(): belongsTo →
boards
posts
모델: App\Models\Boards\Post
- board(): belongsTo →
boards - comments(): hasMany →
board_comments - files(): morphMany →
files
post_custom_field_values
모델: App\Models\Boards\PostCustomFieldValue
- post(): belongsTo →
posts - field(): belongsTo →
board_settings
categorys
모델: App\Models\Commons\Category
- parent(): belongsTo →
categories - children(): hasMany →
categories - products(): hasMany →
products - categoryFields(): hasMany →
category_fields
category_fields
모델: App\Models\Commons\CategoryField
- category(): belongsTo →
categories
category_logs
모델: App\Models\Commons\CategoryLog
- category(): belongsTo →
categories
category_templates
모델: App\Models\Commons\CategoryTemplate
- category(): belongsTo →
categories
files
모델: App\Models\Commons\File
- tenant(): belongsTo →
tenants - folder(): belongsTo →
folders - uploader(): belongsTo →
users - shareLinks(): hasMany →
file_share_links - fileable(): morphTo →
(Polymorphic)
menus
모델: App\Models\Commons\Menu
- parent(): belongsTo →
menus - children(): hasMany →
menus
tags
모델: App\Models\Commons\Tag
- tenant(): belongsTo →
tenants
bom_templates
모델: App\Models\Design\BomTemplate
- modelVersion(): belongsTo →
model_versions - items(): hasMany →
bom_template_items
bom_template_items
모델: App\Models\Design\BomTemplateItem
- template(): belongsTo →
bom_templates
design_models
모델: App\Models\Design\DesignModel
- versions(): hasMany →
model_versions
model_versions
모델: App\Models\Design\ModelVersion
- model(): belongsTo →
models - bomTemplates(): hasMany →
bom_templates
estimates
모델: App\Models\Estimate\Estimate
- modelSet(): belongsTo →
categories - items(): hasMany →
estimate_items
estimate_items
모델: App\Models\Estimate\EstimateItem
- estimate(): belongsTo →
estimates
file_share_links
모델: App\Models\FileShareLink
- file(): belongsTo →
files - tenant(): belongsTo →
tenants
folders
모델: App\Models\Folder
custom_tabs
모델: App\Models\ItemMaster\CustomTab
- columnSetting(): hasOne →
tab_columns
entity_relationships
모델: App\Models\ItemMaster\EntityRelationship
- parent(): morphTo →
(Polymorphic) - child(): morphTo →
(Polymorphic)
item_pages
모델: App\Models\ItemMaster\ItemPage
- sections(): hasMany →
item_sections - sectionRelationships(): hasMany →
entity_relationships - fieldRelationships(): hasMany →
entity_relationships - allRelationships(): hasMany →
entity_relationships
item_sections
모델: App\Models\ItemMaster\ItemSection
- fieldRelationships(): hasMany →
entity_relationships - bomRelationships(): hasMany →
entity_relationships - allChildRelationships(): hasMany →
entity_relationships
tab_columns
모델: App\Models\ItemMaster\TabColumn
- tab(): belongsTo →
custom_tabs
main_requests
모델: App\Models\MainRequest
- flows(): hasMany →
main_request_flows
main_request_flows
모델: App\Models\MainRequestFlow
- mainRequest(): belongsTo →
main_requests - flowable(): morphTo →
(Polymorphic)
materials
모델: App\Models\Materials\Material
- receipts(): hasMany →
material_receipts - lots(): hasMany →
lots - files(): morphMany →
files
material_inspections
모델: App\Models\Materials\MaterialInspection
- receipt(): belongsTo →
material_receipts - items(): hasMany →
material_inspection_items
material_inspection_items
모델: App\Models\Materials\MaterialInspectionItem
- inspection(): belongsTo →
material_inspections
material_receipts
모델: App\Models\Materials\MaterialReceipt
- material(): belongsTo →
materials - inspections(): hasMany →
material_inspections
users
모델: App\Models\Members\User
- userTenants(): hasMany →
user_tenants - userRoles(): hasMany →
user_roles - userTenant(): hasOne →
user_tenants - userTenantById(): hasOne →
user_tenants - tenantsMembership(): belongsToMany →
tenants - files(): morphMany →
files
user_menu_permissions
모델: App\Models\Members\UserMenuPermission
- user(): belongsTo →
users - menu(): belongsTo →
menus
user_roles
모델: App\Models\Members\UserRole
- user(): belongsTo →
users - tenant(): belongsTo →
tenants - role(): belongsTo →
roles
user_tenants
모델: App\Models\Members\UserTenant
- user(): belongsTo →
users - tenant(): belongsTo →
tenants
clients
모델: App\Models\Orders\Client
- clientGroup(): belongsTo →
client_groups - orders(): hasMany →
orders
client_groups
모델: App\Models\Orders\ClientGroup
- clients(): hasMany →
clients
orders
모델: App\Models\Orders\Order
- items(): hasMany →
order_items - histories(): hasMany →
order_histories - versions(): hasMany →
order_versions
order_historys
모델: App\Models\Orders\OrderHistory
- order(): belongsTo →
orders
order_items
모델: App\Models\Orders\OrderItem
- order(): belongsTo →
orders - components(): hasMany →
order_item_components
order_item_components
모델: App\Models\Orders\OrderItemComponent
- orderItem(): belongsTo →
order_items
order_versions
모델: App\Models\Orders\OrderVersion
- order(): belongsTo →
orders
permissions
모델: App\Models\Permissions\Permission
- tenant(): belongsTo →
tenants
permission_overrides
모델: App\Models\Permissions\PermissionOverride
- permission(): belongsTo →
permissions
roles
모델: App\Models\Permissions\Role
- tenant(): belongsTo →
tenants - menuPermissions(): hasMany →
role_menu_permissions - userRoles(): hasMany →
user_roles
role_menu_permissions
모델: App\Models\Permissions\RoleMenuPermission
- role(): belongsTo →
roles - menu(): belongsTo →
menus
common_codes
모델: App\Models\Products\CommonCode
- parent(): belongsTo →
common_codes - children(): hasMany →
common_codes
parts
모델: App\Models\Products\Part
- category(): belongsTo →
common_codes - partType(): belongsTo →
common_codes
price_historys
모델: App\Models\Products\PriceHistory
- clientGroup(): belongsTo →
client_groups
products
모델: App\Models\Products\Product
- category(): belongsTo →
categories - componentLines(): hasMany →
product_components - parentLines(): hasMany →
product_components - children(): belongsToMany →
products - parents(): belongsToMany →
products - files(): morphMany →
files
product_components
모델: App\Models\Products\ProductComponent
- parentProduct(): belongsTo →
products - product(): belongsTo →
products - material(): belongsTo →
materials
lots
모델: App\Models\Qualitys\Lot
- material(): belongsTo →
materials - sales(): hasMany →
lot_sales
lot_sales
모델: App\Models\Qualitys\LotSale
- lot(): belongsTo →
lots
departments
모델: App\Models\Tenants\Department
- parent(): belongsTo →
departments - children(): hasMany →
departments - departmentUsers(): hasMany →
department_user - users(): belongsToMany →
users - permissionOverrides(): morphMany →
permission_overrides
payments
모델: App\Models\Tenants\Payment
- subscription(): belongsTo →
subscriptions
department_users
모델: App\Models\Tenants\Pivots\DepartmentUser
- department(): belongsTo →
departments - user(): belongsTo →
users
plans
모델: App\Models\Tenants\Plan
- subscriptions(): hasMany →
subscriptions
setting_field_defs
모델: App\Models\Tenants\SettingFieldDef
- tenantSettings(): hasMany →
tenant_field_settings
subscriptions
모델: App\Models\Tenants\Subscription
- tenant(): belongsTo →
tenants - plan(): belongsTo →
plans - payments(): hasMany →
payments
tenants
모델: App\Models\Tenants\Tenant
- plan(): belongsTo →
plans - subscription(): belongsTo →
subscriptions - userTenants(): hasMany →
user_tenants - roles(): hasMany →
roles - userRoles(): hasMany →
user_roles - users(): belongsToMany →
users - files(): morphMany →
files
tenant_field_settings
모델: App\Models\Tenants\TenantFieldSetting
- fieldDef(): belongsTo →
setting_field_defs - optionGroup(): belongsTo →
tenant_option_groups
tenant_option_groups
모델: App\Models\Tenants\TenantOptionGroup
- values(): hasMany →
tenant_option_values
tenant_option_values
모델: App\Models\Tenants\TenantOptionValue
- group(): belongsTo →
tenant_option_groups
tenant_stat_fields
모델: App\Models\Tenants\TenantStatField
- tenant(): belongsTo →
tenants
tenant_user_profiles
모델: App\Models\Tenants\TenantUserProfile
- user(): belongsTo →
users - department(): belongsTo →
departments