CREATE TABLE MUNJAON_MSG
(
	MSG_ID			NUMBER 	NOT NULL,
	MSG_TYPE		CHAR(1)			DEFAULT '3'			NOT NULL,
	SEND_STATUS		VARCHAR2(10)		DEFAULT '0'			NOT NULL,
	REQUEST_DATE	DATE		DEFAULT SYSDATE	NOT NULL,
	RECV_PHONE		VARCHAR2(15)							NOT NULL,
	SEND_PHONE		VARCHAR2(15)							NOT NULL,
	SUBJECT			VARCHAR2(60),
	MESSAGE			VARCHAR2(2000)						NOT NULL,
	TELECOM         VARCHAR2(7),
	AGENT_CODE      VARCHAR2(5),
	FILENAME01		VARCHAR2(100),
	FILENAME02		VARCHAR2(100),
	FILENAME03		VARCHAR2(100),
	KAKAO_SENDER_KEY		VARCHAR2(40),
	KAKAO_TEMPLATE_CODE		VARCHAR2(64),
	KAKAO_JSON_FILE		VARCHAR2(100),
	DELIVER_DATE	DATE,
	SENT_DATE		DATE,
	REPORT_DATE		DATE,
	CONSTRAINT PK_MUNJAON_MSG PRIMARY KEY (MSG_ID)
);

CREATE INDEX IDX_MUNJAON_MSG_1 ON MUNJAON_MSG(REQUEST_DATE, SEND_STATUS);
CREATE INDEX IDX_MUNJAON_MSG_2 ON MUNJAON_MSG(RECV_PHONE);
CREATE INDEX IDX_MUNJAON_MSG_3 ON MUNJAON_MSG(SEND_STATUS);

CREATE TABLE MUNJAON_MSG_LOG
(
	MSG_ID			NUMBER ,
	MSG_TYPE		CHAR(1)			DEFAULT '1'			NOT NULL,
	SEND_STATUS		VARCHAR2(10)		DEFAULT '0'			NOT NULL,
	REQUEST_DATE	DATE							NOT NULL,
	RECV_PHONE		VARCHAR2(15)							NOT NULL,
	SEND_PHONE		VARCHAR2(15)							NOT NULL,
	SUBJECT			VARCHAR2(60),
	MESSAGE			VARCHAR2(2000)						NOT NULL,
	TELECOM         VARCHAR2(7),
	AGENT_CODE      VARCHAR2(5),
	FILENAME01		VARCHAR2(100),
	FILENAME02		VARCHAR2(100),
	FILENAME03		VARCHAR2(100),
	KAKAO_SENDER_KEY		VARCHAR2(40),
	KAKAO_TEMPLATE_CODE		VARCHAR2(64),
	KAKAO_JSON_FILE		VARCHAR2(100),
	DELIVER_DATE	DATE,
	SENT_DATE		DATE,
	REPORT_DATE		DATE
);

CREATE INDEX IDX_MUNJAON_MSG_LOG_1 ON MUNJAON_MSG_LOG(REQUEST_DATE, SEND_STATUS);
CREATE INDEX IDX_MUNJAON_MSG_LOG_2 ON MUNJAON_MSG_LOG(RECV_PHONE);
CREATE INDEX IDX_MUNJAON_MSG_LOG_3 ON MUNJAON_MSG_LOG(SEND_STATUS);
CREATE INDEX IDX_MUNJAON_MSG_LOG_4 ON MUNJAON_MSG_LOG(MSG_ID);

CREATE SEQUENCE MUNJAON_MSG_SEQUENCE
		START WITH 1
		MAXVALUE 99999999
		MINVALUE 1
		CYCLE
		NOCACHE
		NOORDER
		;