
CREATE TABLE "BD_REGION_VERTEX" (
                                             "PK_ID" NUMBER(6,0),
                                             "CREATION_TIME" DATE NOT NULL,
                                             "MODIFIED_TIME" DATE,
                                             "NAME" VARCHAR2(200 BYTE) NOT NULL,
                                             "DEL_FLAG" NUMBER,
                                             "PK_MODIFIED" NUMBER,
                                             "PK_COUNTRY" NUMBER(4,0),
                                             "PK_CREATOR" NUMBER(20,0)
)
    LOGGING
NOCOMPRESS
PCTFREE 10
INITRANS 1
STORAGE (
  INITIAL 65536
  NEXT 1048576
  MINEXTENTS 1
  MAXEXTENTS 2147483645
  BUFFER_POOL DEFAULT
)
PARALLEL 1
NOCACHE
DISABLE ROW MOVEMENT
;
COMMENT ON COLUMN "BD_REGION_VERTEX"."CREATION_TIME" IS '创建时间';
COMMENT ON COLUMN "BD_REGION_VERTEX"."MODIFIED_TIME" IS '更新时间';
COMMENT ON COLUMN "BD_REGION_VERTEX"."NAME" IS '区域体系分组名称';
COMMENT ON COLUMN "BD_REGION_VERTEX"."DEL_FLAG" IS '是否删除 0是 1否';
COMMENT ON COLUMN "BD_REGION_VERTEX"."PK_MODIFIED" IS '修改人';
COMMENT ON COLUMN "BD_REGION_VERTEX"."PK_COUNTRY" IS '国家';
COMMENT ON COLUMN "BD_REGION_VERTEX"."PK_CREATOR" IS '创建者';
COMMENT ON TABLE "BD_REGION_VERTEX" IS '区域体系分组配置表';

-- ----------------------------
-- Checks structure for table BD_REGION_VERTEX
-- ----------------------------
ALTER TABLE "BD_REGION_VERTEX" ADD CONSTRAINT "SYS_C00325281" CHECK ("CREATION_TIME" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "BD_REGION_VERTEX" ADD CONSTRAINT "SYS_C00325282" CHECK ("NAME" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
CREATE SEQUENCE BD_REGION_VERTEX_SEQ
    START WITH 1
    INCREMENT BY 1;

ALTER TABLE "BD_VERTEX"
    ADD ("REGION_VERTEX_PK_ID" NUMBER(6,0));

COMMENT ON COLUMN "BD_VERTEX"."REGION_VERTEX_PK_ID" IS '区域体系分组配置表ID';

ALTER TABLE "CU_MEMBER_RETAIL_REGION"
    ADD ("REGION_VERTEX_PK_ID" NUMBER(6,0));

COMMENT ON COLUMN "CU_MEMBER_RETAIL_REGION"."REGION_VERTEX_PK_ID" IS '区域体系分组配置表ID';


ALTER TABLE "CU_MEMBER"
    ADD ("IS_REGION" NUMBER(1,0) DEFAULT 1 NOT NULL)
ADD ("IS_ACTIVATE" NUMBER(1,0) DEFAULT 1 NOT NULL);

COMMENT ON COLUMN "CU_MEMBER"."IS_REGION" IS '是否收益区域（0=是，1=否）';

COMMENT ON COLUMN "CU_MEMBER"."IS_ACTIVATE" IS '是否激活（0=是，1=否）';



CREATE TABLE "BD_AWARDS_REGION_CONFIG" (
                                      "PK_ID" NUMBER(20,0),
                                      "AREA_TYPE" NUMBER(4,0),
                                      "PK_AWARDS" NUMBER(20,0),
                                      "AWARDS_VALUE" NUMBER(4,0),
                                      "RATE" NUMBER(10,2),
                                      PRIMARY KEY ("PK_ID")
)
;

COMMENT ON COLUMN "BD_AWARDS_REGION_CONFIG"."PK_AWARDS" IS '奖衔ID';

COMMENT ON COLUMN "BD_AWARDS_REGION_CONFIG"."AWARDS_VALUE" IS '奖衔值';

COMMENT ON COLUMN "BD_AWARDS_REGION_CONFIG"."AREA_TYPE" IS '可配置类型(3-区,2-市,1-省)';
COMMENT ON COLUMN "BD_AWARDS_REGION_CONFIG"."RATE" IS '比例';

COMMENT ON TABLE "BD_AWARDS_REGION_CONFIG" IS '奖衔区域配置';
CREATE SEQUENCE BD_AWARDS_REGION_CONFIG_SEQ
    START WITH 1
    INCREMENT BY 1;
ALTER TABLE "BD_AWARDS_REGION_CONFIG"
    ADD ("DEL_FLAG" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE)
    ADD ("CREATION_TIME" DATE DEFAULT sysdate NOT NULL ENABLE)
    ADD ("MODIFIED_TIME" DATE)
    ADD ("PK_CREATOR" NUMBER(20,0) NOT NULL ENABLE)
ADD ("PK_MODIFIED" NUMBER(20,0));
ALTER TABLE "BD_AWARDS_REGION_CONFIG"
ADD ("PK_COUNTRY" NUMBER(6,0));
insert into BD_AWARDS_REGION_CONFIG (PK_ID, AREA_TYPE, PK_AWARDS, AWARDS_VALUE, RATE, DEL_FLAG, CREATION_TIME, MODIFIED_TIME, PK_CREATOR, PK_MODIFIED) values (BD_AWARDS_REGION_CONFIG_SEQ.nextval, 3, 2, 5, 0.05, 0, sysdate, sysdate, 100000000, 100000000);
insert into BD_AWARDS_REGION_CONFIG (PK_ID, AREA_TYPE, PK_AWARDS, AWARDS_VALUE, RATE, DEL_FLAG, CREATION_TIME, MODIFIED_TIME, PK_CREATOR, PK_MODIFIED) values (BD_AWARDS_REGION_CONFIG_SEQ.nextval, 2, 3, 10, 0.1, 0, sysdate, sysdate, 100000000, 100000000);
insert into BD_AWARDS_REGION_CONFIG (PK_ID, AREA_TYPE, PK_AWARDS, AWARDS_VALUE, RATE, DEL_FLAG, CREATION_TIME, MODIFIED_TIME, PK_CREATOR, PK_MODIFIED) values (BD_AWARDS_REGION_CONFIG_SEQ.nextval, 1, 4, 15, 0.15, 0, sysdate, sysdate, 100000000, 100000000);


ALTER TABLE "CU_MEMBER_RETAIL_REGION"
    ADD ("SOURCE" NUMBER(1,0) DEFAULT 1 NOT NULL);
COMMENT ON COLUMN "CLOUD_2"."CU_MEMBER_RETAIL_REGION"."SOURCE" IS '来源（1=前台，2=后台）';

ALTER TABLE "CU_MEMBER_RETAIL_REGION"
    ADD ("EFFECTIVE_END_DATE" DATE DEFAULT TO_DATE('2099-01-01', 'YYYY-MM-DD'));

COMMENT ON COLUMN "CLOUD_2"."CU_MEMBER_RETAIL_REGION"."EFFECTIVE_END_DATE" IS '生效结束时间';

ALTER TABLE "CU_MEMBER_RETAIL_REGION"
    ADD ("SYSTEM_TYPE" NUMBER(2) DEFAULT 0);
