CREATE TABLE MUNJAON_MSG
(
	MSG_ID			BIGINT			IDENTITY (1, 1) 	NOT NULL,
	MSG_TYPE		CHAR(1)			DEFAULT '3'			NOT NULL,
	SEND_STATUS		VARCHAR(10)		DEFAULT '0'			NOT NULL,
	REQUEST_DATE	DATETIME		DEFAULT GETDATE()	NOT NULL,
	RECV_PHONE		VARCHAR(15)							NOT NULL,
	SEND_PHONE		VARCHAR(15)							NOT NULL,
	SUBJECT			VARCHAR(60),
	MESSAGE			VARCHAR(2000)						NOT NULL,
	TELECOM         VARCHAR(7),
	AGENT_CODE      VARCHAR(5),
	FILENAME01		VARCHAR(100),
	FILENAME02		VARCHAR(100),
	FILENAME03		VARCHAR(100),
	KAKAO_SENDER_KEY		VARCHAR(40),
	KAKAO_TEMPLATE_CODE		VARCHAR(64),
	KAKAO_JSON_FILE		VARCHAR(100),
	DELIVER_DATE	DATETIME,
	SENT_DATE		DATETIME,
	REPORT_DATE		DATETIME,
	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			BIGINT ,
	MSG_TYPE		CHAR(1)			DEFAULT '1'			NOT NULL,
	SEND_STATUS		VARCHAR(10)		DEFAULT '0'			NOT NULL,
	REQUEST_DATE	DATETIME							NOT NULL,
	RECV_PHONE		VARCHAR(15)							NOT NULL,
	SEND_PHONE		VARCHAR(15)							NOT NULL,
	SUBJECT			VARCHAR(60),
	MESSAGE			VARCHAR(2000)						NOT NULL,
	TELECOM         VARCHAR(7),
	AGENT_CODE      VARCHAR(5),
	FILENAME01		VARCHAR(100),
	FILENAME02		VARCHAR(100),
	FILENAME03		VARCHAR(100),
	KAKAO_SENDER_KEY		VARCHAR(40),
	KAKAO_TEMPLATE_CODE		VARCHAR(64),
	KAKAO_JSON_FILE		VARCHAR(100),
	DELIVER_DATE	DATETIME,
	SENT_DATE		DATETIME,
	REPORT_DATE		DATETIME
);

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);