﻿/* Sequence 저장테이블 */
CREATE TABLE COMTECOPSEQ
(
	TABLE_NAME            VARCHAR2(20)  NOT NULL ,
	NEXT_ID               NUMBER(30)  NULL ,
CONSTRAINT  COMTECOPSEQ_PK PRIMARY KEY (TABLE_NAME)
);




/* 공통분류코드 */
CREATE TABLE COMTCCMMNCLCODE
(
	CL_CODE               CHAR(3)  NOT NULL ,
	CL_CODE_NM            VARCHAR2(60)  NULL ,
	CL_CODE_DC            VARCHAR2(200)  NULL ,
	USE_AT                CHAR(1)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTCCMMNCLCODE_PK PRIMARY KEY (CL_CODE)
);




/* 공통코드 */
CREATE TABLE COMTCCMMNCODE
(
	CODE_ID               VARCHAR2(6)  NOT NULL ,
	CODE_ID_NM            VARCHAR2(60)  NULL ,
	CODE_ID_DC            VARCHAR2(200)  NULL ,
	USE_AT                CHAR(1)  NULL ,
	CL_CODE               CHAR(3)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTCCMMNCODE_PK PRIMARY KEY (CODE_ID),
CONSTRAINT  COMTCCMMNCODE_FK1 FOREIGN KEY (CL_CODE) REFERENCES COMTCCMMNCLCODE(CL_CODE) ON DELETE CASCADE
);

CREATE INDEX COMTCCMMNCODE_i01 ON COMTCCMMNCODE
(CL_CODE  ASC);



/* 공통상세코드 */
CREATE TABLE COMTCCMMNDETAILCODE
(
	CODE_ID               VARCHAR2(6)  NOT NULL ,
	CODE                  VARCHAR2(15)  NOT NULL ,
	CODE_NM               VARCHAR2(60)  NULL ,
	CODE_DC               VARCHAR2(200)  NULL ,
	USE_AT                CHAR(1)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTCCMMNDETAILCODE_PK PRIMARY KEY (CODE_ID,CODE),
CONSTRAINT  COMTCCMMNDETAILCODE_FK1 FOREIGN KEY (CODE_ID) REFERENCES COMTCCMMNCODE(CODE_ID)
);

CREATE INDEX COMTCCMMNDETAILCODE_i01 ON COMTCCMMNDETAILCODE
(CODE_ID  ASC);



/* 권한그룹정보 */
CREATE TABLE COMTNAUTHORGROUPINFO
(
	GROUP_ID              CHAR(20)  NOT NULL ,
	GROUP_NM              VARCHAR2(60)  NOT NULL ,
	GROUP_CREAT_DE        CHAR(20)  NOT NULL ,
	GROUP_DC              VARCHAR2(100)  NULL ,
CONSTRAINT  COMTNAUTHORGROUPINFO_PK PRIMARY KEY (GROUP_ID)
);




/* 일반회원 */
CREATE TABLE COMTNGNRLMBER
(
	MBER_ID               VARCHAR2(20)  NOT NULL ,
	PASSWORD              VARCHAR2(200)  NOT NULL ,
	PASSWORD_HINT         VARCHAR2(100)  NULL ,
	PASSWORD_CNSR         VARCHAR2(100)  NULL ,
	IHIDNUM               VARCHAR2(200)  NULL ,
	MBER_NM               VARCHAR2(50)  NOT NULL ,
	ZIP                   VARCHAR2(6)  NOT NULL ,
	ADRES                 VARCHAR2(100)  NOT NULL ,
	AREA_NO               VARCHAR2(4)  NOT NULL ,
	MBER_STTUS            VARCHAR2(15)  NULL ,
	DETAIL_ADRES          VARCHAR2(100)  NULL ,
	END_TELNO             VARCHAR2(4)  NOT NULL ,
	MBTLNUM               VARCHAR2(20)  NOT NULL ,
	GROUP_ID              CHAR(20)  NULL ,
	MBER_FXNUM            VARCHAR2(20)  NULL ,
	MBER_EMAIL_ADRES      VARCHAR2(50)  NULL ,
	MIDDLE_TELNO          VARCHAR2(4)  NOT NULL ,
	SBSCRB_DE             DATE  NULL ,
	SEXDSTN_CODE          CHAR(1)  NULL ,
	ESNTL_ID              CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNGNRLMBER_PK PRIMARY KEY (MBER_ID),
CONSTRAINT  COMTNGNRLMBER_FK1 FOREIGN KEY (GROUP_ID) REFERENCES COMTNAUTHORGROUPINFO(GROUP_ID) ON DELETE CASCADE
);

CREATE INDEX COMTNGNRLMBER_i01 ON COMTNGNRLMBER
(GROUP_ID  ASC);



/* 조직정보 */
CREATE TABLE COMTNORGNZTINFO
(
	ORGNZT_ID             CHAR(20)  NOT NULL ,
	ORGNZT_NM             VARCHAR2(20)  NOT NULL ,
	ORGNZT_DC             VARCHAR2(100)  NULL ,
CONSTRAINT  COMTNORGNZTINFO_PK PRIMARY KEY (ORGNZT_ID)
);




/* 업무사용자정보 */
CREATE TABLE COMTNEMPLYRINFO
(
	EMPLYR_ID             VARCHAR2(20)  NOT NULL ,
	ORGNZT_ID             CHAR(20)  NULL ,
	USER_NM               VARCHAR2(60)  NOT NULL ,
	PASSWORD              VARCHAR2(200)  NOT NULL ,
	EMPL_NO               VARCHAR2(20)  NULL ,
	IHIDNUM               VARCHAR2(200)  NULL ,
	SEXDSTN_CODE          CHAR(1)  NULL ,
	BRTHDY                CHAR(20)  NULL ,
	FXNUM                 VARCHAR2(20)  NULL ,
	HOUSE_ADRES           VARCHAR2(100)  NOT NULL ,
	PASSWORD_HINT         VARCHAR2(100)  NOT NULL ,
	PASSWORD_CNSR         VARCHAR2(100)  NOT NULL ,
	HOUSE_END_TELNO       VARCHAR2(4)  NOT NULL ,
	AREA_NO               VARCHAR2(4)  NOT NULL ,
	DETAIL_ADRES          VARCHAR2(100)  NULL ,
	ZIP                   VARCHAR2(6)  NOT NULL ,
	OFFM_TELNO            VARCHAR2(20)  NULL ,
	MBTLNUM               VARCHAR2(20)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	OFCPS_NM              VARCHAR2(60)  NULL ,
	HOUSE_MIDDLE_TELNO    VARCHAR2(4)  NOT NULL ,
	GROUP_ID              CHAR(20)  NULL ,
	PSTINST_CODE          CHAR(8)  NULL ,
	EMPLYR_STTUS_CODE     CHAR(1)  NOT NULL ,
	ESNTL_ID              CHAR(20)  NOT NULL ,
	CRTFC_DN_VALUE        VARCHAR2(100)  NULL ,
	SBSCRB_DE             DATE  NULL ,
CONSTRAINT  COMTNEMPLYRINFO_PK PRIMARY KEY (EMPLYR_ID),
CONSTRAINT  COMTNEMPLYRINFO_FK2 FOREIGN KEY (ORGNZT_ID) REFERENCES COMTNORGNZTINFO(ORGNZT_ID) ON DELETE CASCADE,
CONSTRAINT  COMTNEMPLYRINFO_FK1 FOREIGN KEY (GROUP_ID) REFERENCES COMTNAUTHORGROUPINFO(GROUP_ID) ON DELETE CASCADE
);

CREATE INDEX COMTNEMPLYRINFO_i01 ON COMTNEMPLYRINFO
(ORGNZT_ID  ASC);
CREATE INDEX COMTNEMPLYRINFO_i02 ON COMTNEMPLYRINFO
(GROUP_ID  ASC);



/* 기업회원 */
CREATE TABLE COMTNENTRPRSMBER
(
	ENTRPRS_MBER_ID       VARCHAR2(20)  NOT NULL ,
	ENTRPRS_SE_CODE       CHAR(8)  NULL ,
	BIZRNO                VARCHAR2(10)  NULL ,
	JURIRNO               VARCHAR2(13)  NULL ,
	CMPNY_NM              VARCHAR2(60)  NOT NULL ,
	CXFC                  VARCHAR2(50)  NULL ,
	ZIP                   VARCHAR2(6)  NOT NULL ,
	ADRES                 VARCHAR2(100)  NOT NULL ,
	ENTRPRS_MIDDLE_TELNO  VARCHAR2(4)  NOT NULL ,
	FXNUM                 VARCHAR2(20)  NULL ,
	INDUTY_CODE           CHAR(1)  NULL ,
	APPLCNT_NM            VARCHAR2(50)  NOT NULL ,
	APPLCNT_IHIDNUM       VARCHAR2(200)  NULL ,
	SBSCRB_DE             DATE  NULL ,
	ENTRPRS_MBER_STTUS    VARCHAR2(15)  NULL ,
	ENTRPRS_MBER_PASSWORD  VARCHAR2(200)  NULL ,
	ENTRPRS_MBER_PASSWORD_HINT  VARCHAR2(100)  NOT NULL ,
	ENTRPRS_MBER_PASSWORD_CNSR  VARCHAR2(100)  NOT NULL ,
	GROUP_ID              CHAR(20)  NULL ,
	DETAIL_ADRES          VARCHAR2(100)  NULL ,
	ENTRPRS_END_TELNO     VARCHAR2(4)  NOT NULL ,
	AREA_NO               VARCHAR2(4)  NOT NULL ,
	APPLCNT_EMAIL_ADRES   VARCHAR2(50)  NOT NULL ,
	ESNTL_ID              CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNENTRPRSMBER_PK PRIMARY KEY (ENTRPRS_MBER_ID),
CONSTRAINT  COMTNENTRPRSMBER_FK1 FOREIGN KEY (GROUP_ID) REFERENCES COMTNAUTHORGROUPINFO(GROUP_ID) ON DELETE CASCADE
);

CREATE INDEX COMTNENTRPRSMBER_i01 ON COMTNENTRPRSMBER
(GROUP_ID  ASC);



/* 파일속성 */
CREATE TABLE COMTNFILE
(
	ATCH_FILE_ID          CHAR(20)  NOT NULL ,
	CREAT_DT              DATE  NOT NULL ,
	USE_AT                CHAR(1)  NULL ,
CONSTRAINT  COMTNFILE_PK PRIMARY KEY (ATCH_FILE_ID)
);




/* 파일상세정보 */
CREATE TABLE COMTNFILEDETAIL
(
	ATCH_FILE_ID          CHAR(20)  NOT NULL ,
	FILE_SN               NUMBER(10)  NOT NULL ,
	FILE_STRE_COURS       VARCHAR2(2000)  NOT NULL ,
	STRE_FILE_NM          VARCHAR2(255)  NOT NULL ,
	ORIGNL_FILE_NM        VARCHAR2(255)  NULL ,
	FILE_EXTSN            VARCHAR2(20)  NOT NULL ,
	FILE_CN               CLOB  NULL ,
	FILE_SIZE             NUMBER(8)  NULL ,
CONSTRAINT  COMTNFILEDETAIL_PK PRIMARY KEY (ATCH_FILE_ID,FILE_SN),
CONSTRAINT  COMTNFILEDETAIL_FK1 FOREIGN KEY (ATCH_FILE_ID) REFERENCES COMTNFILE(ATCH_FILE_ID)
);

CREATE INDEX COMTNFILEDETAIL_i01 ON COMTNFILEDETAIL
(ATCH_FILE_ID  ASC);



/* 메일발신관리 */
CREATE TABLE COMTHEMAILDSPTCHMANAGE
(
	MSSAGE_ID             VARCHAR2(20)  NOT NULL ,
	EMAIL_CN              CLOB  NULL ,
	SNDR                  VARCHAR2(50)  NOT NULL ,
	RCVER                 VARCHAR2(50)  NOT NULL ,
	SJ                    VARCHAR2(60)  NOT NULL ,
	SNDNG_RESULT_CODE     CHAR(1)  NULL ,
	DSPTCH_DT             CHAR(20)  NOT NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
CONSTRAINT  COMTHEMAILDSPTCHMANAGE_PK PRIMARY KEY (MSSAGE_ID),
CONSTRAINT  COMTHEMAILDSPTCHMANAGE_FK1 FOREIGN KEY (ATCH_FILE_ID) REFERENCES COMTNFILE(ATCH_FILE_ID)
);

CREATE INDEX COMTHEMAILDSPTCHMANAGE_i01 ON COMTHEMAILDSPTCHMANAGE
(SNDR  ASC);



/* 사용자보안설정 */
CREATE TABLE COMTNEMPLYRSCRTYESTBS
(
	SCRTY_DTRMN_TRGET_ID  VARCHAR2(20)  NOT NULL ,
	MBER_TY_CODE          CHAR(5)  NULL ,
	AUTHOR_CODE           VARCHAR2(30)  NOT NULL 
);

CREATE INDEX COMTNEMPLYRSCRTYESTBS_i04 ON COMTNEMPLYRSCRTYESTBS
(AUTHOR_CODE  ASC);



/* 사용자정보뷰 */
CREATE  VIEW COMVNUSERMASTER ( ESNTL_ID,USER_ID,PASSWORD,USER_NM,USER_ZIP,USER_ADRES,USER_EMAIL,GROUP_ID, USER_SE, ORGNZT_ID ) 
AS  
		SELECT ESNTL_ID, MBER_ID,PASSWORD,MBER_NM,ZIP,ADRES,MBER_EMAIL_ADRES,' ','GNR' AS USER_SE, ' ' ORGNZT_ID
		FROM COMTNGNRLMBER
		
	UNION ALL
		SELECT ESNTL_ID,EMPLYR_ID,PASSWORD,USER_NM,ZIP,HOUSE_ADRES,EMAIL_ADRES,GROUP_ID ,'USR' AS USER_SE, ORGNZT_ID
		FROM COMTNEMPLYRINFO
	UNION ALL
		SELECT ESNTL_ID,ENTRPRS_MBER_ID,ENTRPRS_MBER_PASSWORD,CMPNY_NM,ZIP,ADRES,APPLCNT_EMAIL_ADRES,' ' ,'ENT' AS USER_SE, ' ' ORGNZT_ID
		FROM COMTNENTRPRSMBER 
ORDER BY ESNTL_ID;


/* 권한정보 */
CREATE TABLE COMTNAUTHORINFO
(
	AUTHOR_CODE           VARCHAR2(30)  NOT NULL ,
	AUTHOR_NM             VARCHAR2(60)  NOT NULL ,
	AUTHOR_DC             VARCHAR2(200)  NULL ,
	AUTHOR_CREAT_DE       CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNAUTHORINFO_PK PRIMARY KEY (AUTHOR_CODE)
);




/* 롤 계층구조 */
CREATE TABLE COMTNROLES_HIERARCHY
(
	PARNTS_ROLE           VARCHAR2(30)  NOT NULL ,
	CHLDRN_ROLE           VARCHAR2(30)  NOT NULL ,
CONSTRAINT  COMTNROLES_HIERARCHY_PK PRIMARY KEY (PARNTS_ROLE,CHLDRN_ROLE),
CONSTRAINT  COMTNROLES_HIERARCHY_FK1 FOREIGN KEY (PARNTS_ROLE) REFERENCES COMTNAUTHORINFO(AUTHOR_CODE) ON DELETE CASCADE,
CONSTRAINT  COMTNROLES_HIERARCHY_FK2 FOREIGN KEY (CHLDRN_ROLE) REFERENCES COMTNAUTHORINFO(AUTHOR_CODE) ON DELETE CASCADE
);

CREATE UNIQUE INDEX COMTNROLES_HIERARCHY_i01 ON COMTNROLES_HIERARCHY
(PARNTS_ROLE  ASC);
CREATE INDEX COMTNROLES_HIERARCHY_i02 ON COMTNROLES_HIERARCHY
(CHLDRN_ROLE  ASC);



/* 롤정보 */
CREATE TABLE COMTNROLEINFO
(
	ROLE_CODE             VARCHAR2(50)  NOT NULL ,
	ROLE_NM               VARCHAR2(60)  NOT NULL ,
	ROLE_PTTRN            VARCHAR2(300)  NULL ,
	ROLE_DC               VARCHAR2(200)  NULL ,
	ROLE_TY               VARCHAR2(80)  NULL ,
	ROLE_SORT             VARCHAR2(10)  NULL ,
	ROLE_CREAT_DE         CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNROLEINFO_PK PRIMARY KEY (ROLE_CODE)
);




/* 권한롤관계 */
CREATE TABLE COMTNAUTHORROLERELATE
(
	AUTHOR_CODE           VARCHAR2(30)  NOT NULL ,
	ROLE_CODE             VARCHAR2(50)  NOT NULL ,
	CREAT_DT              DATE  NULL ,
CONSTRAINT  COMTNAUTHORROLERELATE_PK PRIMARY KEY (AUTHOR_CODE,ROLE_CODE),
CONSTRAINT  COMTNAUTHORROLERELATE_FK1 FOREIGN KEY (AUTHOR_CODE) REFERENCES COMTNAUTHORINFO(AUTHOR_CODE) ON DELETE CASCADE,
CONSTRAINT  COMTNAUTHORROLERELATE_FK2 FOREIGN KEY (ROLE_CODE) REFERENCES COMTNROLEINFO(ROLE_CODE) ON DELETE CASCADE
);

CREATE INDEX COMTNAUTHORROLERELATE_i01 ON COMTNAUTHORROLERELATE
(AUTHOR_CODE  ASC);
CREATE INDEX COMTNAUTHORROLERELATE_i02 ON COMTNAUTHORROLERELATE
(ROLE_CODE  ASC);



/* 템플릿 */
CREATE TABLE COMTNTMPLATINFO
(
	TMPLAT_ID             CHAR(20)  NOT NULL ,
	TMPLAT_NM             VARCHAR2(255)  NULL ,
	TMPLAT_COURS          VARCHAR2(2000)  NULL ,
	USE_AT                CHAR(1)  NULL ,
	TMPLAT_SE_CODE        CHAR(6)  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
CONSTRAINT  COMTNTMPLATINFO_PK PRIMARY KEY (TMPLAT_ID)
);




/* 게시판마스터 */
CREATE TABLE COMTNBBSMASTER
(
	BBS_ID                CHAR(20)  NOT NULL ,
	BBS_NM                VARCHAR2(255)  NOT NULL ,
	BBS_INTRCN            VARCHAR2(2400)  NULL ,
	BBS_TY_CODE           CHAR(6)  NOT NULL ,
	REPLY_POSBL_AT        CHAR(1)  NULL ,
	FILE_ATCH_POSBL_AT    CHAR(1)  NOT NULL ,
	ATCH_POSBL_FILE_NUMBER  NUMBER(2)  NOT NULL ,
	ATCH_POSBL_FILE_SIZE  NUMBER(8)  NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	TMPLAT_ID             CHAR(20)  NULL ,
	CMMNTY_ID				CHAR(20) NULL,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
CONSTRAINT  COMTNBBSMASTER_PK PRIMARY KEY (BBS_ID)
);




/* 게시판 */
CREATE TABLE COMTNBBS
(
	NTT_ID                NUMBER(20)  NOT NULL ,
	BBS_ID                CHAR(20)  NOT NULL ,
	NTT_NO                NUMBER(20)  NULL ,
	NTT_SJ                VARCHAR2(2000)  NULL ,
	NTT_CN                CLOB  NULL ,
	ANSWER_AT             CHAR(1)  NULL ,
	PARNTSCTT_NO          NUMBER(10)  NULL ,
	ANSWER_LC             NUMBER(8)  NULL ,
	SORT_ORDR             NUMBER(8)  NULL ,
	RDCNT                 NUMBER(10)  NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	NTCE_BGNDE            CHAR(20)  NULL ,
	NTCE_ENDDE            CHAR(20)  NULL ,
	NTCR_ID               VARCHAR2(20)  NULL ,
	NTCR_NM               VARCHAR2(20)  NULL ,
	PASSWORD              VARCHAR2(200)  NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
	NOTICE_AT				CHAR(1) NULL,
	SJ_BOLD_AT				CHAR(1) NULL,
	SECRET_AT				CHAR(1) NULL,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNBBS_PK PRIMARY KEY (NTT_ID,BBS_ID),
CONSTRAINT  COMTNBBS_FK1 FOREIGN KEY (BBS_ID) REFERENCES COMTNBBSMASTER(BBS_ID)
);

CREATE INDEX COMTNBBS_i01 ON COMTNBBS
(BBS_ID  ASC);



/* 커뮤니티 속성 */
CREATE TABLE COMTNCMMNTY
(
	CMMNTY_ID             CHAR(20)  NOT NULL ,
	CMMNTY_NM             VARCHAR2(255)  NOT NULL ,
	CMMNTY_INTRCN         VARCHAR2(2400)  NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	REGIST_SE_CODE        CHAR(6)  NULL ,
	TMPLAT_ID             CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNCMMNTY_PK PRIMARY KEY (CMMNTY_ID)
);




/* 댓글 */
CREATE TABLE COMTNCOMMENT
(
	NTT_ID                NUMBER(20)  NOT NULL ,
	BBS_ID                CHAR(20)  NOT NULL ,
	ANSWER_NO             NUMBER(20)  NOT NULL ,
	WRTER_ID              VARCHAR2(20)  NULL ,
	WRTER_NM              VARCHAR2(20)  NULL ,
	ANSWER                VARCHAR2(200)  NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	PASSWORD              VARCHAR2(200)  NULL ,
CONSTRAINT  COMTNCOMMENT_PK PRIMARY KEY (NTT_ID,BBS_ID,ANSWER_NO),
CONSTRAINT  COMTNCOMMENT_FK1 FOREIGN KEY (NTT_ID,BBS_ID) REFERENCES COMTNBBS(NTT_ID,BBS_ID)
);

CREATE INDEX COMTNCOMMENT_i01 ON COMTNCOMMENT
(NTT_ID  ASC,BBS_ID  ASC);



/* 스크랩 */
CREATE TABLE COMTNSCRAP
(
	SCRAP_ID              CHAR(20)  NOT NULL ,
	NTT_ID                NUMBER(20)  NOT NULL ,
	BBS_ID                CHAR(20)  NOT NULL ,
	SCRAP_NM              VARCHAR2(100)  NOT NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNSCRAP_PK PRIMARY KEY (SCRAP_ID)
);




/* 게시판활용 */
CREATE TABLE COMTNBBSUSE
(
	BBS_ID                CHAR(20)  NOT NULL ,
	TRGET_ID              CHAR(20)  NOT NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	REGIST_SE_CODE        CHAR(6)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNBBSUSE_PK PRIMARY KEY (BBS_ID,TRGET_ID),
CONSTRAINT  COMTNBBSUSE_FK1 FOREIGN KEY (BBS_ID) REFERENCES COMTNBBSMASTER(BBS_ID)
);

CREATE INDEX COMTNBBSUSE_i01 ON COMTNBBSUSE
(BBS_ID  ASC);



/* 커뮤니티사용자 */
CREATE TABLE COMTNCMMNTYUSER
(
	CMMNTY_ID             CHAR(20)  NOT NULL ,
	EMPLYR_ID             VARCHAR2(20)  NOT NULL ,
	MNGR_AT               CHAR(1)  NOT NULL ,
	MBER_STTUS			VARCHAR2(15) NULL,
	SBSCRB_DE             DATE  NULL ,
	SECSN_DE              CHAR(20)  NULL ,
	USE_AT                CHAR(1)  NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNCMMNTYUSER_PK PRIMARY KEY (CMMNTY_ID,EMPLYR_ID),
CONSTRAINT  COMTNCMMNTYUSER_FK1 FOREIGN KEY (CMMNTY_ID) REFERENCES COMTNCMMNTY(CMMNTY_ID)
);

CREATE INDEX COMTNCMMNTYUSER_i01 ON COMTNCMMNTYUSER
(CMMNTY_ID  ASC);



/* 일정정보 */
CREATE TABLE COMTNSCHDULINFO
(
	SCHDUL_ID             CHAR(20)  NOT NULL ,
	SCHDUL_SE             CHAR(1)  NULL ,
	SCHDUL_DEPT_ID        VARCHAR2(20)  NULL ,
	SCHDUL_KND_CODE       CHAR(1)  NULL ,
	SCHDUL_BGNDE          CHAR(20)  NULL ,
	SCHDUL_ENDDE          CHAR(20)  NULL ,
	SCHDUL_NM             VARCHAR2(255)  NULL ,
	SCHDUL_CN             VARCHAR2(2500)  NULL ,
	SCHDUL_PLACE          VARCHAR2(255)  NULL ,
	SCHDUL_IPCR_CODE      CHAR(1)  NULL ,
	SCHDUL_CHARGER_ID     VARCHAR2(20)  NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	REPTIT_SE_CODE        CHAR(1)  NULL ,
CONSTRAINT  COMTNSCHDULINFO_PK PRIMARY KEY (SCHDUL_ID)
);




/* 일지정보 */
CREATE TABLE COMTNDIARYINFO
(
	SCHDUL_ID             CHAR(20)  NOT NULL ,
	DIARY_ID              CHAR(20)  NOT NULL ,
	DIARY_PROGRSRT        NUMBER(3)  NULL ,
	DIARY_NM              VARCHAR2(255)  NULL ,
	DRCT_MATTER           VARCHAR2(2500)  NULL ,
	PARTCLR_MATTER        VARCHAR2(2500)  NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNDIARYINFO_PK PRIMARY KEY (SCHDUL_ID,DIARY_ID),
CONSTRAINT  COMTNDIARYINFO_FK1 FOREIGN KEY (SCHDUL_ID) REFERENCES COMTNSCHDULINFO(SCHDUL_ID)
);

CREATE INDEX COMTNDIARYINFO_i01 ON COMTNDIARYINFO
(SCHDUL_ID  ASC);



/* 명함정보속성 */
CREATE TABLE COMTNNCRD
(
	NCRD_ID               CHAR(20)  NOT NULL ,
	NCRD_TRGTER_ID        VARCHAR2(20)  NULL ,
	NM                    VARCHAR2(50)  NOT NULL ,
	TELNO                 VARCHAR2(20)  NULL ,
	NATION_NO             VARCHAR2(10)  NULL ,
	AREA_NO               VARCHAR2(4)  NULL ,
	MIDDLE_TELNO          VARCHAR2(4)  NULL ,
	END_TELNO             VARCHAR2(4)  NULL ,
	MBTLNUM               VARCHAR2(20)  NULL ,
	IDNTFC_NO             VARCHAR2(10)  NULL ,
	MIDDLE_MBTLNUM        VARCHAR2(4)  NULL ,
	END_MBTLNUM           VARCHAR2(4)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	CMPNY_NM              VARCHAR2(60)  NULL ,
	DEPT_NM               VARCHAR2(60)  NULL ,
	ADRES                 VARCHAR2(100)  NULL ,
	DETAIL_ADRES          VARCHAR2(100)  NULL ,
	OFCPS_NM              VARCHAR2(60)  NULL ,
	CLSF_NM               VARCHAR2(60)  NULL ,
	EXTRL_USER_AT         CHAR(1)  NULL ,
	OTHBC_AT              CHAR(1)  NOT NULL ,
	RM                    VARCHAR2(2500)  NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNNCRD_PK PRIMARY KEY (NCRD_ID)
);




/* 주소록관리 */
CREATE TABLE COMTNADBKMANAGE
(
	ADBK_ID               CHAR(20)  NOT NULL ,
	ADBK_NM               VARCHAR2(50)  NOT NULL ,
	OTHBC_SCOPE           VARCHAR2(20)  NOT NULL ,
	USE_AT                CHAR(1)  NOT NULL ,
	WRTER_ID              VARCHAR2(20)  NULL ,
	TRGET_ORGNZT_ID       CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNADBKMANAGE_PK PRIMARY KEY (ADBK_ID)
);




/* 주소록 */
CREATE TABLE COMTNADBK
(
	EMPLYR_ID             VARCHAR2(20) NULL ,
	NCRD_ID               CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	ADBK_CONSTNT_ID       CHAR(20)  NOT NULL ,
	NM                    VARCHAR2(50)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	MBTLNUM               VARCHAR2(20)  NULL ,
	FXNUM                 VARCHAR2(20)  NULL ,
	OFFM_TELNO            VARCHAR2(20)  NULL ,
	HOUSE_TELNO           VARCHAR2(20)  NULL ,
	ADBK_ID               CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNADBK_PK PRIMARY KEY (ADBK_CONSTNT_ID,ADBK_ID),
CONSTRAINT  COMTNADBK_FK1 FOREIGN KEY (ADBK_ID) REFERENCES COMTNADBKMANAGE(ADBK_ID) ON DELETE CASCADE
);

CREATE INDEX COMTNADBK_i01 ON COMTNADBK
(ADBK_ID  ASC);



/* 약관정보 */
CREATE TABLE COMTNSTPLATINFO
(
	USE_STPLAT_ID         CHAR(20)  NOT NULL ,
	USE_STPLAT_NM         VARCHAR2(100)  NULL ,
	USE_STPLAT_CN         CLOB  NULL ,
	INFO_PROVD_AGRE_CN    CLOB  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNSTPLATINFO_PK PRIMARY KEY (USE_STPLAT_ID)
);




/* 업무사용자정보변경내역 */
CREATE TABLE COMTHEMPLYRINFOCHANGEDTLS
(
	EMPLYR_ID             VARCHAR2(20)  NOT NULL ,
	CHANGE_DE             CHAR(20)  NULL ,
	ORGNZT_ID             CHAR(20)  NULL ,
	GROUP_ID              CHAR(20)  NULL ,
	EMPL_NO               VARCHAR2(20)  NULL ,
	SEXDSTN_CODE          CHAR(1)  NULL ,
	BRTHDY                CHAR(20)  NULL ,
	FXNUM                 VARCHAR2(20)  NULL ,
	HOUSE_ADRES           VARCHAR2(100)  NULL ,
	HOUSE_END_TELNO       VARCHAR2(4)  NULL ,
	AREA_NO               VARCHAR2(4)  NULL ,
	DETAIL_ADRES          VARCHAR2(100)  NULL ,
	ZIP                   VARCHAR2(6)  NULL ,
	OFFM_TELNO            VARCHAR2(20)  NULL ,
	MBTLNUM               VARCHAR2(20)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	HOUSE_MIDDLE_TELNO    VARCHAR2(4)  NULL ,
	PSTINST_CODE          CHAR(8)  NULL ,
	EMPLYR_STTUS_CODE     CHAR(1)  NULL ,
	ESNTL_ID              CHAR(20)  NULL ,
CONSTRAINT  COMTHEMPLYRINFOCHANGEDTLS_PK PRIMARY KEY (EMPLYR_ID,CHANGE_DE),
CONSTRAINT  COMTHEMPLYRINFOCHANGEDTLS_FK1 FOREIGN KEY (EMPLYR_ID) REFERENCES COMTNEMPLYRINFO(EMPLYR_ID)
);

CREATE INDEX COMTHEMPLYRINFOCHANGEDTLS_i01 ON COMTHEMPLYRINFOCHANGEDTLS
(EMPLYR_ID  ASC);



/* 마이페이지 컨텐츠 */
CREATE TABLE COMTNINDVDLPGECNTNTS
(
	CNTNTS_ID             VARCHAR2(20)  NOT NULL ,
	CNTNTS_NM             VARCHAR2(100)  NOT NULL ,
	CNTC_URL              VARCHAR2(255)  NOT NULL ,
	CNTNTS_USE_AT         CHAR(1)  NOT NULL ,
	CNTNTS_LINK_URL       VARCHAR2(1000)  NULL ,
	CNTNTS_DC             VARCHAR2(250)  NULL ,
CONSTRAINT  COMTNINDVDLPGECNTNTS_PK PRIMARY KEY (CNTNTS_ID)
);




/* 마이페이지 설정 */
CREATE TABLE COMTNINDVDLPGEESTBS
(
	EMPLYR_ID             VARCHAR2(20)  NOT NULL ,
	UPEND_IMAGE           VARCHAR2(1024)  NULL ,
	TITLEBAR_COLOR        CHAR(7)  NULL ,
	ALGN_MTHD             CHAR(1)  NULL ,
	ALGN_CO               NUMBER(10)  NULL ,
CONSTRAINT  COMTNINDVDLPGEESTBS_PK PRIMARY KEY (EMPLYR_ID)
);




/* 도움말정보 */
CREATE TABLE COMTNHPCMINFO
(
	HPCM_ID               CHAR(20)  NOT NULL ,
	HPCM_SE_CODE          CHAR(1)  NULL ,
	HPCM_DFN              VARCHAR2(1000)  NULL ,
	HPCM_DC               VARCHAR2(2500)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNHPCMINFO_PK PRIMARY KEY (HPCM_ID)
);




/* 용어사전정보 */
CREATE TABLE COMTNWORDDICARYINFO
(
	WORD_ID               CHAR(20)  NOT NULL ,
	WORD_NM               VARCHAR2(255)  NULL ,
	ENG_NM                VARCHAR2(60)  NULL ,
	WORD_DC               VARCHAR2(4000)  NULL ,
	SYNONM                VARCHAR2(100)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNWORDDICARYINFO_PK PRIMARY KEY (WORD_ID)
);




/* FAQ정보 */
CREATE TABLE COMTNFAQINFO
(
	FAQ_ID                CHAR(20)  NOT NULL ,
	QESTN_SJ              VARCHAR2(255)  NULL ,
	QESTN_CN              VARCHAR2(2500)  NULL ,
	ANSWER_CN             VARCHAR2(2500)  NULL ,
	RDCNT                 NUMBER(10)  NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NOT NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NOT NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
	QNA_PROCESS_STTUS_CODE  CHAR(1)  NULL ,
CONSTRAINT  COMTNFAQINFO_PK PRIMARY KEY (FAQ_ID)
);




/* QA정보 */
CREATE TABLE COMTNQAINFO
(
	QA_ID                 CHAR(20)  NOT NULL ,
	QESTN_SJ              VARCHAR2(255)  NULL ,
	QESTN_CN              VARCHAR2(2500)  NULL ,
	WRITNG_DE             CHAR(20)  NULL ,
	RDCNT                 NUMBER(10)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	QNA_PROCESS_STTUS_CODE  CHAR(1)  NULL ,
	WRTER_NM              VARCHAR2(20)  NULL ,
	ANSWER_CN             VARCHAR2(2500)  NULL ,
	WRITNG_PASSWORD       VARCHAR2(20)  NULL ,
	ANSWER_DE             CHAR(20)  NULL ,
	EMAIL_ANSWER_AT       CHAR(1)  NULL ,
	AREA_NO               VARCHAR2(4)  NULL ,
	MIDDLE_TELNO          VARCHAR2(4)  NULL ,
	END_TELNO             VARCHAR2(4)  NULL ,
CONSTRAINT  COMTNQAINFO_PK PRIMARY KEY (QA_ID)
);




/* 행정용어사전관리 */
CREATE TABLE COMTNADMINISTRATIONWORD
(
	ADMINIST_WORD_ID      CHAR(20)  NOT NULL ,
	ADMINIST_WORD_NM      VARCHAR2(255)  NULL ,
	ADMINIST_WORD_ENG_NM  VARCHAR2(255)  NULL ,
	ADMINIST_WORD_ABRV_NM  VARCHAR2(255)  NULL ,
	THEMA_RELM            VARCHAR2(255)  NULL ,
	WORD_SE               VARCHAR2(255)  NULL ,
	RELATE_STD_WORD       VARCHAR2(255)  NULL ,
	ADMINIST_WORD_DFN     VARCHAR2(2500)  NULL ,
	ADMINIST_WORD_DC      VARCHAR2(4000)  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
CONSTRAINT  COMTNADMINISTRATIONWORD_PK PRIMARY KEY (ADMINIST_WORD_ID)
);




/* 온라인메뉴얼 */
CREATE TABLE COMTNONLINEMANUAL
(
	ONLINE_MNL_ID         CHAR(20)  NOT NULL ,
	ONLINE_MNL_SE_CODE    CHAR(3)  NULL ,
	ONLINE_MNL_DFN        CLOB  NULL ,
	ONLINE_MNL_DC         CLOB  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	ONLINE_MNL_NM         VARCHAR2(255)  NULL ,
CONSTRAINT  COMTNONLINEMANUAL_PK PRIMARY KEY (ONLINE_MNL_ID)
);




/* 상담내역 */
CREATE TABLE COMTNCNSLTLIST
(
	CNSLT_ID              CHAR(20)  NOT NULL ,
	CNSLT_SJ              VARCHAR2(255)  NULL ,
	OTHBC_AT              CHAR(1)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	CNSLT_CN              VARCHAR2(2500)  NULL ,
	MANAGT_CN             VARCHAR2(2500)  NULL ,
	MANAGT_DE             CHAR(20)  NULL ,
	RDCNT                 NUMBER(10)  NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	AREA_NO               VARCHAR2(4)  NULL ,
	MIDDLE_TELNO          VARCHAR2(4)  NULL ,
	END_TELNO             VARCHAR2(4)  NULL ,
	FRST_MBTLNUM          VARCHAR2(4)  NULL ,
	MIDDLE_MBTLNUM        VARCHAR2(4)  NULL ,
	END_MBTLNUM           VARCHAR2(4)  NULL ,
	WRITNG_DE             CHAR(20)  NULL ,
	WRTER_NM              VARCHAR2(20)  NULL ,
	EMAIL_ANSWER_AT       CHAR(1)  NULL ,
	QNA_PROCESS_STTUS_CODE  CHAR(1)  NULL ,
	WRITNG_PASSWORD       VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNCNSLTLIST_PK PRIMARY KEY (CNSLT_ID)
);




/* 온라인POLL관리 */
CREATE TABLE COMTNONLINEPOLLMANAGE
(
	POLL_ID               CHAR(20)  NOT NULL ,
	POLL_NM               VARCHAR2(255)  NULL ,
	POLL_BGNDE            CHAR(10)  NULL ,
	POLL_ENDDE            CHAR(10)  NULL ,
	POLL_KND              CHAR(3)  NULL ,
	POLL_DSUSE_ENNC       CHAR(1)  NULL ,
	POLL_ATMC_DSUSE_ENNC  CHAR(1)  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
CONSTRAINT  COMTNONLINEPOLLMANAGE_PK PRIMARY KEY (POLL_ID)
);




/* 온라인POLL항목 */
CREATE TABLE COMTNONLINEPOLLIEM
(
	POLL_IEM_NM           VARCHAR2(255)  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	POLL_IEM_ID           CHAR(20)  NOT NULL ,
	POLL_ID               CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNONLINEPOLLIEM_PK PRIMARY KEY (POLL_ID,POLL_IEM_ID),
CONSTRAINT  COMTNONLINEPOLLIEM_FK1 FOREIGN KEY (POLL_ID) REFERENCES COMTNONLINEPOLLMANAGE(POLL_ID)
);

CREATE INDEX COMTNONLINEPOLLIEM_i01 ON COMTNONLINEPOLLIEM
(POLL_ID  ASC);



/* 온라인POLL결과 */
CREATE TABLE COMTNONLINEPOLLRESULT
(
	POLL_RESULT_ID        CHAR(20)  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	POLL_IEM_ID           CHAR(20)  NOT NULL ,
	POLL_ID               CHAR(20)  NOT NULL ,
CONSTRAINT  COMTNONLINEPOLLRESULT_PK PRIMARY KEY (POLL_RESULT_ID,POLL_IEM_ID,POLL_ID),
CONSTRAINT  COMTNONLINEPOLLRESULT_FK1 FOREIGN KEY (POLL_ID,POLL_IEM_ID) REFERENCES COMTNONLINEPOLLIEM(POLL_ID,POLL_IEM_ID)
);

CREATE INDEX COMTNONLINEPOLLRESULT_i01 ON COMTNONLINEPOLLRESULT
(POLL_IEM_ID  ASC,POLL_ID  ASC);



/* 뉴스정보 */
CREATE TABLE COMTNNEWSINFO
(
	NEWS_ID               CHAR(20)  NOT NULL ,
	NEWS_SJ               VARCHAR2(100)  NULL ,
	NEWS_CN               VARCHAR2(2500)  NULL ,
	NEWS_ORIGIN           VARCHAR2(250)  NULL ,
	NTCE_AT               CHAR(1)  NULL ,
	FRST_REGIST_PNTTM     DATE  NOT NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NOT NULL ,
	LAST_UPDT_PNTTM       DATE  NOT NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NOT NULL ,
	NTCE_DE               CHAR(20)  NULL ,
	ATCH_FILE_ID          CHAR(20)  NULL ,
CONSTRAINT  COMTNNEWSINFO_PK PRIMARY KEY (NEWS_ID),
CONSTRAINT  COMTNNEWSINFO_FK1 FOREIGN KEY (ATCH_FILE_ID) REFERENCES COMTNFILE(ATCH_FILE_ID) ON DELETE CASCADE
);

CREATE INDEX COMTNNEWSINFO_i01 ON COMTNNEWSINFO
(ATCH_FILE_ID  ASC);



/* 사이트목록 */
CREATE TABLE COMTNSITELIST
(
	SITE_ID               CHAR(20)  NOT NULL ,
	SITE_NM               VARCHAR2(100)  NULL ,
	SITE_URL              VARCHAR2(100)  NULL ,
	SITE_DC               VARCHAR2(1000)  NULL ,
	SITE_THEMA_CL_CODE    VARCHAR2(2)  NULL ,
	ACTVTY_AT             CHAR(1)  NULL ,
	USE_AT                CHAR(1)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNSITELIST_PK PRIMARY KEY (SITE_ID)
);




/* 추천사이트정보 */
CREATE TABLE COMTNRECOMENDSITEINFO
(
	RECOMEND_SITE_ID      CHAR(20)  NOT NULL ,
	RECOMEND_SITE_NM      VARCHAR2(100)  NULL ,
	RECOMEND_SITE_URL     VARCHAR2(255)  NULL ,
	RECOMEND_SITE_DC      VARCHAR2(1000)  NULL ,
	RECOMEND_RESN_CN      VARCHAR2(1000)  NULL ,
	RECOMEND_CONFM_AT     CHAR(1)  NULL ,
	CONFM_DE              CHAR(20)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNRECOMENDSITEINFO_PK PRIMARY KEY (RECOMEND_SITE_ID)
);




/* 행사/이벤트정보 */
CREATE TABLE COMTNEVENTINFO
(
	EVENT_ID              CHAR(20)  NOT NULL ,
	BSNS_YEAR             CHAR(4)  NULL ,
	BSNS_CODE             VARCHAR2(2)  NULL ,
	EVENT_CN              VARCHAR2(1000)  NULL ,
	EVENT_SVC_BGNDE       CHAR(20)  NULL ,
	SVC_USE_NMPR_CO       NUMBER(10)  NULL ,
	CHARGER_NM            VARCHAR2(50)  NULL ,
	PRPARETG_CN           VARCHAR2(2500)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
	EVENT_SVC_ENDDE       CHAR(20)  NULL ,
	EVENT_TY_CODE         CHAR(1)  NULL ,
	EVENT_CONFM_AT        CHAR(1)  NULL ,
	EVENT_CONFM_DE        CHAR(20)  NULL ,
CONSTRAINT  COMTNEVENTINFO_PK PRIMARY KEY (EVENT_ID)
);




/* 외부인사정보 */
CREATE TABLE COMTNEXTRLHRINFO
(
	EVENT_ID              CHAR(20)  NOT NULL ,
	EXTRL_HR_ID           CHAR(20)  NOT NULL ,
	SEXDSTN_CODE          CHAR(1)  NULL ,
	EXTRL_HR_NM           VARCHAR2(60)  NULL ,
	OCCP_TY_CODE          CHAR(1)  NULL ,
	PSITN_INSTT_NM        VARCHAR2(100)  NULL ,
	BRTHDY                CHAR(20)  NULL ,
	AREA_NO               VARCHAR2(4)  NULL ,
	MIDDLE_TELNO          VARCHAR2(4)  NULL ,
	END_TELNO             VARCHAR2(4)  NULL ,
	EMAIL_ADRES           VARCHAR2(50)  NULL ,
	FRST_REGIST_PNTTM     DATE  NULL ,
	FRST_REGISTER_ID      VARCHAR2(20)  NULL ,
	LAST_UPDT_PNTTM       DATE  NULL ,
	LAST_UPDUSR_ID        VARCHAR2(20)  NULL ,
CONSTRAINT  COMTNEXTRLHRINFO_PK PRIMARY KEY (EVENT_ID,EXTRL_HR_ID),
CONSTRAINT  COMTNEXTRLHRINFO_FK1 FOREIGN KEY (EVENT_ID) REFERENCES COMTNEVENTINFO(EVENT_ID)
);

CREATE INDEX COMTNEXTRLHRINFO_i01 ON COMTNEXTRLHRINFO
(EVENT_ID  ASC);



