260321:1700 Correct Coresspondence / Doing RFA
This commit is contained in:
@@ -125,16 +125,18 @@ LCBP3-DMS ต้องสร้างเลขที่เอกสารอั
|
||||
CREATE TABLE document_number_formats (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
project_id INT NOT NULL,
|
||||
correspondence_type_id INT NULL COMMENT 'Specific Type ID, or NULL for Project Default', -- CHANGED: Allow NULL
|
||||
correspondence_type_id INT NULL COMMENT 'Specific Type ID, or NULL for Project Default',
|
||||
discipline_id INT DEFAULT 0 COMMENT 'Specific Discipline ID, or 0 for All',
|
||||
format_template VARCHAR(100) NOT NULL COMMENT 'e.g. {PROJECT}-{TYPE}-{YEAR}-{SEQ:4}',
|
||||
description TEXT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (correspondence_type_id) REFERENCES correspondence_types(id) ON DELETE CASCADE,
|
||||
-- Note: Application logic must enforce single default format per project
|
||||
UNIQUE KEY unique_format (project_id, correspondence_type_id)
|
||||
-- Note: Application logic uses automated Upsert based on business key
|
||||
UNIQUE KEY unique_format (project_id, correspondence_type_id, discipline_id)
|
||||
) ENGINE=InnoDB COMMENT='Template configurations for document numbering';
|
||||
|
||||
-- Counter Table with Optimistic Locking
|
||||
@@ -975,3 +977,4 @@ ensure:
|
||||
| 1.0 | 2025-11-30 | Initial decision |
|
||||
| 2.0 | 2025-12-02 | Updated with comprehensive error scenarios, monitoring, security, and all token types |
|
||||
| 3.0 | 2025-12-17 | Aligned with Requirements v1.6.2: updated counter schema, token definitions, Number State Machine |
|
||||
| 4.0 | 2026-03-21 | Added discipline_id to formats, implemented automated Upsert logic for template management |
|
||||
|
||||
Reference in New Issue
Block a user