text: /*
   Navicat Premium Data Transfer
  
   Source Server         : 192.168.1.99
   Source Server Type    : Oracle
   Source Server Version : 110200
   Source Host           : 192.168.1.99:1521
   Source Schema         : APOLLOPORTALDB
  
   Target Server Type    : Oracle
   Target Server Version : 110200
   File Encoding         : 65001
  
   Date: 30/07/2020 19:48:37
  */
  
  
  -- ----------------------------
  -- Table structure for APP
  -- ----------------------------
  CREATE TABLE   APP (
    ID NUMBER NOT NULL ,
    APPID   VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    NAME   VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    ORGID VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    ORGNAME VARCHAR2(64 BYTE) DEFAULT 'default'  NOT NULL ,
    OWNERNAME VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    OWNEREMAIL VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   APP.ID IS '主键';
  COMMENT ON COLUMN   APP.APPID IS 'APPID';
  COMMENT ON COLUMN   APP.NAME IS '应用名';
  COMMENT ON COLUMN   APP.ORGID IS '部门Id';
  COMMENT ON COLUMN   APP.ORGNAME IS '部门名字';
  COMMENT ON COLUMN   APP.OWNERNAME IS 'ownerName';
  COMMENT ON COLUMN   APP.OWNEREMAIL IS 'ownerEmail';
  COMMENT ON COLUMN   APP.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   APP.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   APP.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   APP.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   APP.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   APP IS '应用表';
  
  -- ----------------------------
  -- Records of APP
  -- ----------------------------
  INSERT INTO   APP VALUES ('1', 'SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com', '0', 'default', TO_DATE('2017-09-11 15:41:26', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:41:26', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for APPNAMESPACE
  -- ----------------------------
  CREATE TABLE   APPNAMESPACE (
    ID NUMBER NOT NULL ,
    NAME VARCHAR2(32 BYTE) NOT NULL ,
    APPID VARCHAR2(32 BYTE) NOT NULL ,
    FORMAT VARCHAR2(32 BYTE) DEFAULT 'properties'  NOT NULL ,
    ISPUBLIC NUMBER(3) DEFAULT 0  NOT NULL ,
    COMMT VARCHAR2(64 BYTE) ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   APPNAMESPACE.ID IS '主键';
  COMMENT ON COLUMN   APPNAMESPACE.NAME IS 'namespace名字，注意，需要全局唯一';
  COMMENT ON COLUMN   APPNAMESPACE.APPID IS 'APPID';
  COMMENT ON COLUMN   APPNAMESPACE.FORMAT IS 'namespace的format类型';
  COMMENT ON COLUMN   APPNAMESPACE.ISPUBLIC IS 'namespace是否为公共';
  COMMENT ON COLUMN   APPNAMESPACE.COMMT IS '注释';
  COMMENT ON COLUMN   APPNAMESPACE.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   APPNAMESPACE.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   APPNAMESPACE.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   APPNAMESPACE.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   APPNAMESPACE.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   APPNAMESPACE IS '应用namespace定义';
  
  -- ----------------------------
  -- Records of APPNAMESPACE
  -- ----------------------------
  INSERT INTO   APPNAMESPACE VALUES ('1', 'application', 'SampleApp', 'properties', '0', 'default app namespace', '0', NULL, TO_DATE('2017-09-11 15:41:27', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:41:27', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for AUTHORITIES
  -- ----------------------------
  CREATE TABLE   AUTHORITIES (
    ID NUMBER NOT NULL ,
    USERNAME VARCHAR2(64 BYTE) NOT NULL ,
    AUTHORITY VARCHAR2(50 BYTE) NOT NULL
  )
  ;
  COMMENT ON COLUMN   AUTHORITIES.ID IS '主键';
  COMMENT ON COLUMN   AUTHORITIES.USERNAME IS '用户名';
  COMMENT ON COLUMN   AUTHORITIES.AUTHORITY IS '授权';
  COMMENT ON TABLE   AUTHORITIES IS '授权';
  
  -- ----------------------------
  -- Records of AUTHORITIES
  -- ----------------------------
  INSERT INTO   AUTHORITIES VALUES ('1', 'apollo', 'ROLE_user');
  
  -- ----------------------------
  -- Table structure for CONSUMER
  -- ----------------------------
  CREATE TABLE   CONSUMER (
    ID NUMBER NOT NULL ,
    APPID VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    NAME VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    ORGID VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    ORGNAME VARCHAR2(64 BYTE) DEFAULT 'default'  NOT NULL ,
    OWNERNAME VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    OWNEREMAIL VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   CONSUMER.ID IS '主键';
  COMMENT ON COLUMN   CONSUMER.APPID IS 'APPID';
  COMMENT ON COLUMN   CONSUMER.NAME IS '应用名';
  COMMENT ON COLUMN   CONSUMER.ORGID IS '部门Id';
  COMMENT ON COLUMN   CONSUMER.ORGNAME IS '部门名字';
  COMMENT ON COLUMN   CONSUMER.OWNERNAME IS 'ownerName';
  COMMENT ON COLUMN   CONSUMER.OWNEREMAIL IS 'ownerEmail';
  COMMENT ON COLUMN   CONSUMER.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   CONSUMER.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   CONSUMER.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   CONSUMER.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   CONSUMER.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   CONSUMER IS '开放API消费者';
  
  -- ----------------------------
  -- Table structure for CONSUMERAUDIT
  -- ----------------------------
  CREATE TABLE   CONSUMERAUDIT (
    ID NUMBER NOT NULL ,
    CONSUMERID NUMBER ,
    URI VARCHAR2(1024 BYTE) NOT NULL ,
    METHOD VARCHAR2(16 BYTE) NOT NULL ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   CONSUMERAUDIT.ID IS '主键';
  COMMENT ON COLUMN   CONSUMERAUDIT.CONSUMERID IS 'Consumer Id';
  COMMENT ON COLUMN   CONSUMERAUDIT.URI IS '访问的Uri';
  COMMENT ON COLUMN   CONSUMERAUDIT.METHOD IS '访问的Method';
  COMMENT ON COLUMN   CONSUMERAUDIT.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   CONSUMERAUDIT.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   CONSUMERAUDIT IS 'consumer审计表';
  
  -- ----------------------------
  -- Table structure for CONSUMERROLE
  -- ----------------------------
  CREATE TABLE   CONSUMERROLE (
    ID NUMBER NOT NULL ,
    CONSUMERID NUMBER ,
    ROLEID NUMBER ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) DEFAULT 'default'  ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   CONSUMERROLE.ID IS '主键';
  COMMENT ON COLUMN   CONSUMERROLE.CONSUMERID IS 'Consumer Id';
  COMMENT ON COLUMN   CONSUMERROLE.ROLEID IS 'Role Id';
  COMMENT ON COLUMN   CONSUMERROLE.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   CONSUMERROLE.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   CONSUMERROLE.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   CONSUMERROLE.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   CONSUMERROLE.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   CONSUMERROLE IS 'consumer和role的绑定表';
  
  -- ----------------------------
  -- Table structure for CONSUMERTOKEN
  -- ----------------------------
  CREATE TABLE   CONSUMERTOKEN (
    ID NUMBER NOT NULL ,
    CONSUMERID NUMBER ,
    TOKEN VARCHAR2(128 BYTE) NOT NULL ,
    EXPIRES TIMESTAMP(6) DEFAULT to_date('2099-01-01', 'YYYY-MM-DD')  NOT NULL ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   CONSUMERTOKEN.ID IS '主键';
  COMMENT ON COLUMN   CONSUMERTOKEN.CONSUMERID IS 'Consumer Id';
  COMMENT ON COLUMN   CONSUMERTOKEN.TOKEN IS 'token';
  COMMENT ON COLUMN   CONSUMERTOKEN.EXPIRES IS 'token失效时间';
  COMMENT ON COLUMN   CONSUMERTOKEN.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   CONSUMERTOKEN.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   CONSUMERTOKEN.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   CONSUMERTOKEN.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   CONSUMERTOKEN.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   CONSUMERTOKEN IS 'consumer token表';
  
  -- ----------------------------
  -- Table structure for FAVORITE
  -- ----------------------------
  CREATE TABLE   FAVORITE (
    ID NUMBER NOT NULL ,
    USERID VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    APPID VARCHAR2(500 BYTE) DEFAULT 'default'  NOT NULL ,
    POSITION NUMBER(10) DEFAULT 10000  NOT NULL ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   FAVORITE.ID IS '主键';
  COMMENT ON COLUMN   FAVORITE.USERID IS '收藏的用户';
  COMMENT ON COLUMN   FAVORITE.APPID IS 'AppID';
  COMMENT ON COLUMN   FAVORITE.POSITION IS '收藏顺序';
  COMMENT ON COLUMN   FAVORITE.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   FAVORITE.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   FAVORITE.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   FAVORITE.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   FAVORITE.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   FAVORITE IS '应用收藏表';
  
  -- ----------------------------
  -- Table structure for PERMISSION
  -- ----------------------------
  CREATE TABLE   PERMISSION (
    ID NUMBER NOT NULL ,
    PERMISSIONTYPE VARCHAR2(32 BYTE) NOT NULL ,
    TARGETID VARCHAR2(256 BYTE) NOT NULL ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   PERMISSION.ID IS '主键';
  COMMENT ON COLUMN   PERMISSION.PERMISSIONTYPE IS '权限类型';
  COMMENT ON COLUMN   PERMISSION.TARGETID IS '权限对象类型';
  COMMENT ON COLUMN   PERMISSION.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   PERMISSION.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   PERMISSION.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   PERMISSION.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   PERMISSION.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   PERMISSION IS 'permission表';
  
  -- ----------------------------
  -- Records of PERMISSION
  -- ----------------------------
  INSERT INTO   PERMISSION VALUES ('1', 'CreateCluster', 'SampleApp', '0', NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   PERMISSION VALUES ('2', 'CreateNamespace', 'SampleApp', '0', NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   PERMISSION VALUES ('3', 'AssignRole', 'SampleApp', '0', NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   PERMISSION VALUES ('4', 'ModifyNamespace', 'SampleApp+application', '0', NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   PERMISSION VALUES ('5', 'ReleaseNamespace', 'SampleApp+application', '0', NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   PERMISSION VALUES ('6', 'CreateApplication', 'SystemRole', '0', 'apollo', TO_DATE('2017-09-12 12:06:26', 'SYYYY-MM-DD HH24:MI:SS'), 'apollo', TO_DATE('2017-09-12 12:06:26', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for ROLE
  -- ----------------------------
  CREATE TABLE   ROLE (
    ID NUMBER NOT NULL ,
    ROLENAME VARCHAR2(256 BYTE) NOT NULL ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   ROLE.ID IS '主键';
  COMMENT ON COLUMN   ROLE.ROLENAME IS '角色名称';
  COMMENT ON COLUMN   ROLE.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   ROLE.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   ROLE.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   ROLE.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   ROLE.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   ROLE IS '角色表';
  
  -- ----------------------------
  -- Records of ROLE
  -- ----------------------------
  INSERT INTO   ROLE VALUES ('1', 'Master+SampleApp', '0', 'default', TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLE VALUES ('2', 'ModifyNamespace+SampleApp+application', '0', 'default', TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLE VALUES ('3', 'ReleaseNamespace+SampleApp+application', '0', 'default', TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:48', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLE VALUES ('4', 'CreateApplication+SystemRole', '0', 'apollo', TO_DATE('2017-09-12 12:06:26', 'SYYYY-MM-DD HH24:MI:SS'), 'apollo', TO_DATE('2017-09-12 12:06:26', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for ROLEPERMISSION
  -- ----------------------------
  CREATE TABLE   ROLEPERMISSION (
    ID NUMBER NOT NULL ,
    ROLEID NUMBER ,
    PERMISSIONID NUMBER ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   ROLEPERMISSION.ID IS '主键';
  COMMENT ON COLUMN   ROLEPERMISSION.ROLEID IS '角色ID';
  COMMENT ON COLUMN   ROLEPERMISSION.PERMISSIONID IS 'Permission Id';
  COMMENT ON COLUMN   ROLEPERMISSION.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   ROLEPERMISSION.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   ROLEPERMISSION.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   ROLEPERMISSION.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   ROLEPERMISSION.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   ROLEPERMISSION IS '角色和权限的绑定表';
  
  -- ----------------------------
  -- Records of ROLEPERMISSION
  -- ----------------------------
  INSERT INTO   ROLEPERMISSION VALUES ('1', '1', '1', '0', NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLEPERMISSION VALUES ('2', '1', '2', '0', NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLEPERMISSION VALUES ('3', '1', '3', '0', NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLEPERMISSION VALUES ('4', '2', '4', '0', NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLEPERMISSION VALUES ('5', '3', '5', '0', NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:49', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   ROLEPERMISSION VALUES ('6', '4', '6', '0', 'apollo', TO_DATE('2017-09-12 12:06:26', 'SYYYY-MM-DD HH24:MI:SS'), 'apollo', TO_DATE('2017-09-12 12:06:26', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for SERVERCONFIG
  -- ----------------------------
  CREATE TABLE   SERVERCONFIG (
    ID NUMBER NOT NULL ,
    KEY_COL VARCHAR2(64 BYTE) DEFAULT 'default'  NOT NULL ,
    VALUE_COL VARCHAR2(2048 BYTE) ,
    COMMT VARCHAR2(1024 BYTE) ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) DEFAULT 'default'  NOT NULL ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   SERVERCONFIG.ID IS '主键';
  COMMENT ON COLUMN   SERVERCONFIG.KEY_COL IS '配置项Key';
  COMMENT ON COLUMN   SERVERCONFIG.VALUE_COL IS '配置项值';
  COMMENT ON COLUMN   SERVERCONFIG.COMMT IS '注释';
  COMMENT ON COLUMN   SERVERCONFIG.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   SERVERCONFIG.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   SERVERCONFIG.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   SERVERCONFIG.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   SERVERCONFIG.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   SERVERCONFIG IS '配置服务自身配置';
  
  -- ----------------------------
  -- Records of SERVERCONFIG
  -- ----------------------------
  INSERT INTO   SERVERCONFIG VALUES ('1', 'apollo.portal.envs', 'dev', '可支持的环境列表', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-15 10:38:00', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   SERVERCONFIG VALUES ('2', 'organizations', '[{orgId:dept02,orgName:部门1},{orgId:dept01,orgName:部门2}]', '部门列表', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   SERVERCONFIG VALUES ('3', 'superAdmin', 'apollo', 'Portal超级管理员', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   SERVERCONFIG VALUES ('4', 'api.readTimeout', '10000', 'http接口read timeout', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   SERVERCONFIG VALUES ('5', 'consumer.token.salt', 'someSalt', 'consumer token salt', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   SERVERCONFIG VALUES ('6', 'admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有namespace', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   SERVERCONFIG VALUES ('7', 'configView.memberOnly.envs', 'dev', '只对项目成员显示配置信息的环境列表，多个env以英文逗号分隔', '0', 'default', TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:47', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for SYS_ID_MACHINE
  -- ----------------------------
  CREATE TABLE   SYS_ID_MACHINE (
    MACHINE_IP NVARCHAR2(16) NOT NULL ,
    MACHINE_ID NUMBER(11) NOT NULL ,
    ADD_TIME DATE NOT NULL ,
    HEART_LAST_TIME DATE NOT NULL
  )
  ;
  COMMENT ON COLUMN   SYS_ID_MACHINE.MACHINE_IP IS '主机IP';
  COMMENT ON COLUMN   SYS_ID_MACHINE.MACHINE_ID IS '主机IP对应的机器码';
  COMMENT ON COLUMN   SYS_ID_MACHINE.ADD_TIME IS '创建时间';
  COMMENT ON COLUMN   SYS_ID_MACHINE.HEART_LAST_TIME IS '最后一次心跳时间';
  
  -- ----------------------------
  -- Table structure for USERROLE
  -- ----------------------------
  CREATE TABLE   USERROLE (
    ID NUMBER NOT NULL ,
    USERID VARCHAR2(128 BYTE) ,
    ROLEID NUMBER ,
    ISDELETED NUMBER(3) DEFAULT 0  NOT NULL ,
    DATACHANGE_CREATEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_CREATEDTIME DATE NOT NULL ,
    DATACHANGE_LASTMODIFIEDBY VARCHAR2(32 BYTE) ,
    DATACHANGE_LASTTIME DATE
  )
  ;
  COMMENT ON COLUMN   USERROLE.ID IS '主键';
  COMMENT ON COLUMN   USERROLE.USERID IS '用户身份标识';
  COMMENT ON COLUMN   USERROLE.ROLEID IS '角色ID';
  COMMENT ON COLUMN   USERROLE.ISDELETED IS '删除标志：1: deleted, 0: normal';
  COMMENT ON COLUMN   USERROLE.DATACHANGE_CREATEDBY IS '创建人';
  COMMENT ON COLUMN   USERROLE.DATACHANGE_CREATEDTIME IS '创建时间';
  COMMENT ON COLUMN   USERROLE.DATACHANGE_LASTMODIFIEDBY IS '最后修改人';
  COMMENT ON COLUMN   USERROLE.DATACHANGE_LASTTIME IS '最后修改时间';
  COMMENT ON TABLE   USERROLE IS '用户和role的绑定表';
  
  -- ----------------------------
  -- Records of USERROLE
  -- ----------------------------
  INSERT INTO   USERROLE VALUES ('1', 'apollo', '1', '0', NULL, TO_DATE('2017-09-11 15:36:50', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:50', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   USERROLE VALUES ('2', 'apollo', '2', '0', NULL, TO_DATE('2017-09-11 15:36:50', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:50', 'SYYYY-MM-DD HH24:MI:SS'));
  INSERT INTO   USERROLE VALUES ('3', 'apollo', '3', '0', NULL, TO_DATE('2017-09-11 15:36:50', 'SYYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2017-09-11 15:36:50', 'SYYYY-MM-DD HH24:MI:SS'));
  
  -- ----------------------------
  -- Table structure for USERS
  -- ----------------------------
  CREATE TABLE   USERS (
    ID NUMBER NOT NULL ,
    USERNAME VARCHAR2(64 BYTE) DEFAULT 'default'  NOT NULL ,
    PASSWORD VARCHAR2(64 BYTE) DEFAULT 'default'  NOT NULL ,
    EMAIL VARCHAR2(64 BYTE) DEFAULT 'default'  NOT NULL ,
    ENABLED NUMBER(4)
  )
  ;
  COMMENT ON COLUMN   USERS.ID IS '主键';
  COMMENT ON COLUMN   USERS.USERNAME IS '用户名';
  COMMENT ON COLUMN   USERS.PASSWORD IS '密码';
  COMMENT ON COLUMN   USERS.EMAIL IS '邮箱地址';
  COMMENT ON COLUMN   USERS.ENABLED IS '是否有效, 1：enable, 0：normal';
  COMMENT ON TABLE   USERS IS '用户表';
  
  -- ----------------------------
  -- Records of USERS
  -- ----------------------------
  INSERT INTO   USERS VALUES ('1', 'apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo@acme.com', '1');
  
  -- ----------------------------
  -- Primary Key structure for table APP
  -- ----------------------------
  ALTER TABLE   APP ADD CONSTRAINT AP_PRIMARY00001 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table APP
  -- ----------------------------
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028414 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028415 CHECK (APPID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028416 CHECK (NAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028417 CHECK (ORGID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028418 CHECK (ORGNAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028419 CHECK (OWNERNAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028420 CHECK (OWNEREMAIL IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028421 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APP ADD CONSTRAINT AP_SYS_C0028422 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table APP
  -- ----------------------------
  CREATE INDEX   AP_APPID00001
    ON   APP (APPID ASC);
  CREATE INDEX   AP_DATACHANGE_LASTTIME00001
    ON   APP (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_NAME
    ON   APP (NAME ASC);
  
  -- ----------------------------
  -- Primary Key structure for table APPNAMESPACE
  -- ----------------------------
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_PRIMARY00002 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table APPNAMESPACE
  -- ----------------------------
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028424 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028425 CHECK (NAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028426 CHECK (APPID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028427 CHECK (FORMAT IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028428 CHECK (ISPUBLIC IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028429 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   APPNAMESPACE ADD CONSTRAINT AP_SYS_C0028430 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table APPNAMESPACE
  -- ----------------------------
  CREATE INDEX   AP_DATACHANGE_LASTTIME00002
    ON   APPNAMESPACE (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_APPID
    ON   APPNAMESPACE (APPID ASC);
  CREATE INDEX   AP_NAME_APPID
    ON   APPNAMESPACE (NAME ASC, APPID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table AUTHORITIES
  -- ----------------------------
  ALTER TABLE   AUTHORITIES ADD CONSTRAINT AP_PRIMARY00003 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table AUTHORITIES
  -- ----------------------------
  ALTER TABLE   AUTHORITIES ADD CONSTRAINT AP_SYS_C0028432 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   AUTHORITIES ADD CONSTRAINT AP_SYS_C0028433 CHECK (USERNAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   AUTHORITIES ADD CONSTRAINT AP_SYS_C0028434 CHECK (AUTHORITY IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Primary Key structure for table CONSUMER
  -- ----------------------------
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_PRIMARY00004 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table CONSUMER
  -- ----------------------------
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028436 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028437 CHECK (APPID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028438 CHECK (NAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028439 CHECK (ORGID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028440 CHECK (ORGNAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028441 CHECK (OWNERNAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028442 CHECK (OWNEREMAIL IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028443 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028444 CHECK (DATACHANGE_CREATEDBY IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMER ADD CONSTRAINT AP_SYS_C0028445 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table CONSUMER
  -- ----------------------------
  CREATE INDEX   AP_APPID00004
    ON   CONSUMER (APPID ASC);
  CREATE INDEX   AP_DATACHANGE_LASTTIME00004
    ON   CONSUMER (DATACHANGE_LASTTIME ASC);
  
  -- ----------------------------
  -- Primary Key structure for table CONSUMERAUDIT
  -- ----------------------------
  ALTER TABLE   CONSUMERAUDIT ADD CONSTRAINT AP_PRIMARY00005 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table CONSUMERAUDIT
  -- ----------------------------
  ALTER TABLE   CONSUMERAUDIT ADD CONSTRAINT AP_SYS_C0028447 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERAUDIT ADD CONSTRAINT AP_SYS_C0028448 CHECK (URI IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERAUDIT ADD CONSTRAINT AP_SYS_C0028449 CHECK (METHOD IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERAUDIT ADD CONSTRAINT AP_SYS_C0028450 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table CONSUMERAUDIT
  -- ----------------------------
  CREATE INDEX   AP_DATACHANGE_LASTTIME00005
    ON   CONSUMERAUDIT (DATACHANGE_CREATEDTIME ASC);
  CREATE INDEX   AP_IX_CONSUMERID
    ON   CONSUMERAUDIT (CONSUMERID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table CONSUMERROLE
  -- ----------------------------
  ALTER TABLE   CONSUMERROLE ADD CONSTRAINT AP_PRIMARY00006 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table CONSUMERROLE
  -- ----------------------------
  ALTER TABLE   CONSUMERROLE ADD CONSTRAINT AP_SYS_C0028452 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERROLE ADD CONSTRAINT AP_SYS_C0028453 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERROLE ADD CONSTRAINT AP_SYS_C0028455 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table CONSUMERROLE
  -- ----------------------------
  CREATE INDEX   AP_DATACHANGE_LASTTIME00006
    ON   CONSUMERROLE (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_CONSUMERID_ROLEID
    ON   CONSUMERROLE (CONSUMERID ASC, ROLEID ASC);
  CREATE INDEX   AP_IX_ROLEID
    ON   CONSUMERROLE (ROLEID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table CONSUMERTOKEN
  -- ----------------------------
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_PRIMARY00007 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table CONSUMERTOKEN
  -- ----------------------------
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_SYS_C0028457 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_SYS_C0028458 CHECK (TOKEN IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_SYS_C0028459 CHECK (EXPIRES IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_SYS_C0028460 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_SYS_C0028461 CHECK (DATACHANGE_CREATEDBY IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   CONSUMERTOKEN ADD CONSTRAINT AP_SYS_C0028462 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table CONSUMERTOKEN
  -- ----------------------------
  CREATE INDEX   AP_DATACHANGE_LASTTIME00007
    ON   CONSUMERTOKEN (DATACHANGE_LASTTIME ASC);
  
  
  -- ----------------------------
  -- Primary Key structure for table FAVORITE
  -- ----------------------------
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_PRIMARY00008 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table FAVORITE
  -- ----------------------------
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028464 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028465 CHECK (USERID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028466 CHECK (APPID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028467 CHECK (POSITION IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028468 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028469 CHECK (DATACHANGE_CREATEDBY IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   FAVORITE ADD CONSTRAINT AP_SYS_C0028470 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table FAVORITE
  -- ----------------------------
  CREATE INDEX   AP_APPID00008
    ON   FAVORITE (APPID ASC);
  CREATE INDEX   AP_DATACHANGE_LASTTIME00008
    ON   FAVORITE (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_USERID
    ON   FAVORITE (USERID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table PERMISSION
  -- ----------------------------
  ALTER TABLE   PERMISSION ADD CONSTRAINT AP_PRIMARY00009 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table PERMISSION
  -- ----------------------------
  ALTER TABLE   PERMISSION ADD CONSTRAINT AP_SYS_C0028472 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   PERMISSION ADD CONSTRAINT AP_SYS_C0028473 CHECK (PERMISSIONTYPE IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   PERMISSION ADD CONSTRAINT AP_SYS_C0028474 CHECK (TARGETID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   PERMISSION ADD CONSTRAINT AP_SYS_C0028475 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   PERMISSION ADD CONSTRAINT AP_SYS_C0028476 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table PERMISSION
  -- ----------------------------
  CREATE INDEX   AP_IX_DATACHANGE_LASTTIME00009
    ON   PERMISSION (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_TARGETID_PERMISSIONTYPE
    ON   PERMISSION (PERMISSIONTYPE ASC, TARGETID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table ROLE
  -- ----------------------------
  ALTER TABLE   ROLE ADD CONSTRAINT AP_PRIMARY00010 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table ROLE
  -- ----------------------------
  ALTER TABLE   ROLE ADD CONSTRAINT AP_SYS_C0028478 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   ROLE ADD CONSTRAINT AP_SYS_C0028479 CHECK (ROLENAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   ROLE ADD CONSTRAINT AP_SYS_C0028480 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   ROLE ADD CONSTRAINT AP_SYS_C0028481 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table ROLE
  -- ----------------------------
  CREATE INDEX   AP_IX_DATACHANGE_LASTTIME00010
    ON   ROLE (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   IX_ROLENAME
    ON   ROLE (ROLENAME ASC);
  
  -- ----------------------------
  -- Primary Key structure for table ROLEPERMISSION
  -- ----------------------------
  ALTER TABLE   ROLEPERMISSION ADD CONSTRAINT AP_PRIMARY00011 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table ROLEPERMISSION
  -- ----------------------------
  ALTER TABLE   ROLEPERMISSION ADD CONSTRAINT AP_SYS_C0028483 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   ROLEPERMISSION ADD CONSTRAINT AP_SYS_C0028484 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   ROLEPERMISSION ADD CONSTRAINT AP_SYS_C0028485 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table ROLEPERMISSION
  -- ----------------------------
  CREATE INDEX   AP_IX_DATACHANGE_LASTTIME00011
    ON   ROLEPERMISSION (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_PERMISSIONID
    ON   ROLEPERMISSION (PERMISSIONID ASC);
  CREATE INDEX   AP_IX_ROLEID00011
    ON   ROLEPERMISSION (ROLEID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table SERVERCONFIG
  -- ----------------------------
  ALTER TABLE   SERVERCONFIG ADD CONSTRAINT AP_PRIMARY00013 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table SERVERCONFIG
  -- ----------------------------
  ALTER TABLE   SERVERCONFIG ADD CONSTRAINT AP_SYS_C0028491 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SERVERCONFIG ADD CONSTRAINT AP_SYS_C0028492 CHECK (KEY_COL IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SERVERCONFIG ADD CONSTRAINT AP_SYS_C0028493 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SERVERCONFIG ADD CONSTRAINT AP_SYS_C0028494 CHECK (DATACHANGE_CREATEDBY IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SERVERCONFIG ADD CONSTRAINT AP_SYS_C0028495 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table SERVERCONFIG
  -- ----------------------------
  CREATE INDEX   AP_DATACHANGE_LASTTIME00013
    ON   SERVERCONFIG (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_KEY
    ON   SERVERCONFIG (KEY_COL ASC);
  
  -- ----------------------------
  -- Checks structure for table SYS_ID_MACHINE
  -- ----------------------------
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0026687 CHECK (MACHINE_IP IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0026688 CHECK (MACHINE_ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0026689 CHECK (ADD_TIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0026690 CHECK (HEART_LAST_TIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028622 CHECK (MACHINE_IP IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028623 CHECK (MACHINE_ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028624 CHECK (ADD_TIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028625 CHECK (HEART_LAST_TIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028691 CHECK (MACHINE_IP IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028692 CHECK (MACHINE_ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028693 CHECK (ADD_TIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   SYS_ID_MACHINE ADD CONSTRAINT AP_SYS_C0028694 CHECK (HEART_LAST_TIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Primary Key structure for table USERROLE
  -- ----------------------------
  ALTER TABLE   USERROLE ADD CONSTRAINT AP_PRIMARY00012 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table USERROLE
  -- ----------------------------
  ALTER TABLE   USERROLE ADD CONSTRAINT AP_SYS_C0028487 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   USERROLE ADD CONSTRAINT AP_SYS_C0028488 CHECK (ISDELETED IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   USERROLE ADD CONSTRAINT AP_SYS_C0028489 CHECK (DATACHANGE_CREATEDTIME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  
  -- ----------------------------
  -- Indexes structure for table USERROLE
  -- ----------------------------
  CREATE INDEX   AP_IX_DATACHANGE_LASTTIME00012
    ON   USERROLE (DATACHANGE_LASTTIME ASC);
  CREATE INDEX   AP_IX_ROLEID00012
    ON   USERROLE (ROLEID ASC);
  CREATE INDEX   AP_IX_USERID_ROLEID
    ON   USERROLE (USERID ASC, ROLEID ASC);
  
  -- ----------------------------
  -- Primary Key structure for table USERS
  -- ----------------------------
  ALTER TABLE   USERS ADD CONSTRAINT PRIMARY00014 PRIMARY KEY (ID);
  
  -- ----------------------------
  -- Checks structure for table USERS
  -- ----------------------------
  ALTER TABLE   USERS ADD CONSTRAINT AP_SYS_C0028497 CHECK (ID IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   USERS ADD CONSTRAINT AP_SYS_C0028498 CHECK (USERNAME IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   USERS ADD CONSTRAINT AP_SYS_C0028499 CHECK (PASSWORD IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  ALTER TABLE   USERS ADD CONSTRAINT AP_SYS_C0028500 CHECK (EMAIL IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  