-- ============================================
-- 업체 테이블 (P2-11, P2-12)
-- ============================================
-- 로컬 DB에 없으면:
--   mysql --default-character-set=utf8mb4 -u root -p jongryangje_dev < writable/database/company_tables.sql

CREATE TABLE IF NOT EXISTS `company` (
  `cp_idx`       INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `cp_lg_idx`    INT UNSIGNED NOT NULL COMMENT '지자체 FK',
  `cp_type`      VARCHAR(20) NOT NULL COMMENT '협회/제작업체/회수업체',
  `cp_name`      VARCHAR(100) NOT NULL DEFAULT '' COMMENT '업체명',
  `cp_biz_no`    VARCHAR(20) NOT NULL DEFAULT '' COMMENT '사업자번호',
  `cp_rep_name`  VARCHAR(50) NOT NULL DEFAULT '' COMMENT '대표자명',
  `cp_tel`       VARCHAR(20) NOT NULL DEFAULT '' COMMENT '전화번호',
  `cp_addr`      VARCHAR(255) NOT NULL DEFAULT '' COMMENT '주소',
  `cp_state`     TINYINT UNSIGNED NOT NULL DEFAULT 1,
  `cp_regdate`   DATETIME NOT NULL,
  PRIMARY KEY (`cp_idx`),
  KEY `idx_cp_lg_idx` (`cp_lg_idx`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='업체(협회/제작/회수)';
