-- P5-11: 기타 입출고 테이블
CREATE TABLE IF NOT EXISTS `bag_misc_flow` (
  `bmf_idx` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `bmf_lg_idx` INT UNSIGNED NOT NULL COMMENT '지자체 PK',
  `bmf_type` ENUM('in','out') NOT NULL COMMENT '입고/출고',
  `bmf_bag_code` VARCHAR(50) NOT NULL COMMENT '봉투 코드',
  `bmf_bag_name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '봉투명',
  `bmf_qty` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '수량',
  `bmf_date` DATE NOT NULL COMMENT '입출고 일자',
  `bmf_reason` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '사유',
  `bmf_regdate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '등록일',
  PRIMARY KEY (`bmf_idx`),
  KEY `idx_bmf_lg_date` (`bmf_lg_idx`, `bmf_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='기타 입출고';
