-- DB eopbri
use eopbri;
-- table department     
ALTER TABLE `Department` ADD `attachFile` CHAR( 1 ) NOT NULL ;

-- table DocReceiveSend
ALTER TABLE `DocReceiveSend` ADD `DrsNoRegisReceive` CHAR( 1 ) NOT NULL ;    

-- table DocSecretLevel
ALTER TABLE `DocSecretLevel` ADD `THeGIF_CID` CHAR( 3 ) NOT NULL ;
TRUNCATE TABLE `DocSecretLevel`;
INSERT INTO `DocSecretLevel` (`DclID`, `DclName`, `THeGIF_CID`) VALUES 
(0, 'ปกติ', '001'),
(1, 'ลับ', '002'),
(2, 'ลับมาก', '003'),
(3, 'ลับที่สุด', '004'),
(4, 'ปกปิด', '');

-- table DocSpeedLevel  
ALTER TABLE `DocSpeedLevel` ADD `THeGIF_SID` CHAR( 3 ) NOT NULL ;
TRUNCATE TABLE `DocSpeedLevel`;
INSERT INTO `DocSpeedLevel` (`DslID`, `DslName`, `THeGIF_SID`) VALUES 
(0, 'ปกติ', '001'),
(1, 'ด่วน', '002'),
(2, 'ด่วนมาก', '003'),
(3, 'ด่วนที่สุด', '004');

-- table Documents 
ALTER TABLE `Documents` ADD `Doc_Letter_ID` INT( 11 ) NOT NULL ;


-- table SysConfig 
ALTER TABLE `SysConfig` ADD `canDelDocPs` CHAR( 1 ) NOT NULL ,
ADD `useTHeGIF` CHAR( 1 ) NOT NULL ;    
update `SysConfig`  set useTHeGIF ='N';

-- table collegedetail
ALTER TABLE `collegedetail` ADD `pdId` INT NOT NULL;
update `collegedetail` set pdId='1' WHERE `collegeID`='99';

-- table collegedetail
ALTER TABLE `DocAttatches` CHANGE `DocID` `DocID` BIGINT( 11 ) NOT NULL DEFAULT '0' ;


-- table Department
update Department a, Department b
set a.deptParent = b.deptParentId
where a.deptId = b.deptId;

-- table collegedetail
INSERT INTO `collegedetail` (`cID`, `collegeID`, `collegeName`, `collegeAbbr`, `collegeHost`, `collegeType`, `collegeqCID`, `collegecUID`, `pdId`) VALUES
(39, '41', 'วิทยาลัยพยาบาลบรมราชชนนี แพร่', 'วพบ. แพร่', '110.77.140.204', 'Y', 3, 2, 0);


CREATE TABLE IF NOT EXISTS `correspondenceletter_department` (
  `dm_ID` char(10) NOT NULL,
  `dm_department` text NOT NULL,
  `dmUse` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;