http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql 
b/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
new file mode 100644
index 0000000..ddb211e
--- /dev/null
+++ b/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
@@ -0,0 +1,34 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists insert_public_group_in_x_group_table;
+
+delimiter ;;
+create procedure insert_public_group_in_x_group_table() begin
+
+ /* check table x_group exist or not */
+ if exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_group') then
+       /* check record for group name public exist or not */
+       if not exists (select * from x_group where group_name = 'public') then
+               INSERT INTO x_group (ADDED_BY_ID, CREATE_TIME, DESCR, 
GROUP_SRC, GROUP_TYPE, GROUP_NAME, STATUS, UPDATE_TIME, UPD_BY_ID) VALUES (1, 
UTC_TIMESTAMP(), 'public group', 0, 0, 'public', 0, UTC_TIMESTAMP(), 1);
+       end if;
+ end if;
+  
+end;;
+
+delimiter ;
+call insert_public_group_in_x_group_table();
+
+drop procedure if exists insert_public_group_in_x_group_table;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql 
b/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql
new file mode 100644
index 0000000..d251bc2
--- /dev/null
+++ b/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql
@@ -0,0 +1,186 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- 
--------------------------------------------------------------------------------
+-- Function which will return tempPolicyCount 
+-- which is being used by SP updateBlankPolicyName()
+-- 
--------------------------------------------------------------------------------
+DELIMITER $$
+
+DROP FUNCTION if exists getTempPolicyCount $$
+CREATE FUNCTION `getTempPolicyCount`(assetId bigint, resId bigint) RETURNS 
int(11)
+BEGIN
+
+DECLARE tempPolicyCount int default 1;
+DECLARE dbResourceId bigint;
+DECLARE exitLoop int DEFAULT FALSE;
+
+DECLARE policyList CURSOR FOR 
+       SELECT id from x_resource where asset_id = assetId;
+
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET exitLoop = true;
+OPEN policyList;
+readPolicy : LOOP
+       FETCH policyList into dbResourceId;
+
+       IF exitLoop THEN
+               set tempPolicyCount = tempPolicyCount + 1;
+               LEAVE readPolicy;
+       END IF;
+
+       IF (resId = dbResourceId) THEN
+               LEAVE readPolicy;
+       END IF;
+       set tempPolicyCount = tempPolicyCount + 1;
+
+END LOOP;
+CLOSE policyList;
+
+RETURN tempPolicyCount;
+END $$
+
+
+-- 
--------------------------------------------------------------------------------
+-- Procedure that will generate policy name of policies 
+-- which were previously created without policy_name
+-- 
--------------------------------------------------------------------------------
+DELIMITER $$
+
+DROP PROCEDURE if exists updateBlankPolicyName $$
+CREATE PROCEDURE `updateBlankPolicyName`()
+BEGIN
+
+DECLARE done INT;
+DECLARE resId bigint;
+DECLARE assetId bigint;
+DECLARE assetName varchar(512);
+DECLARE genPolicyName varchar(1000);
+DECLARE existPolId varchar(1000);
+DECLARE policyCount bigint;
+DECLARE currentTime varchar(100);
+DECLARE tempPolicyCount int;
+DECLARE totalPolicyCount int;
+DECLARE resourceName varchar(4000);
+
+-- TrxLog fields
+DECLARE createTime datetime;
+DECLARE addedById bigint;
+DECLARE classType int;
+DECLARE objId bigint;
+DECLARE parentObjId bigint;
+DECLARE parentObjClsType int;
+DECLARE parentObjName varchar(1024);
+DECLARE objName varchar(1024);
+DECLARE attrName varchar(255);
+DECLARE prevVal varchar(1024);
+DECLARE newVal varchar(1024);
+DECLARE trxId varchar(1024);
+DECLARE act varchar(255);
+DECLARE sessType varchar(30);
+DECLARE assetTypeInt int;
+DECLARE assetType varchar(50);
+DECLARE transId varchar(50);
+
+DECLARE policyList CURSOR FOR 
+       select id,asset_id, res_name from x_resource res 
+               where res.policy_name is null or res.policy_name = '';
+
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
+OPEN policyList;
+
+       SET done = 0;
+       
+       iLoop : LOOP
+
+       FETCH policyList into resId, assetId, resourceName;
+
+       set assetTypeInt = (select asset_type from x_asset where id = assetId);
+
+       if (assetTypeInt = 1) then
+               set assetType = 'HDFS';
+       elseif  (assetTypeInt = 2) then
+               set assetType = 'HBase';
+       elseif ((assetTypeInt = 3)) then
+               set assetType = 'Hive';
+       elseif (assetTypeInt = 4) then
+               set assetType = 'XAAGENT';
+       elseif (assetTypeInt = 5) then
+               set assetType = 'Knox';
+       elseif (assetTypeInt = 6) then
+               set assetType = 'Storm';
+       end if;
+
+       set totalPolicyCount = (select count(*) from x_resource where asset_id 
= assetId);
+       set assetName = (select asset_name from x_asset asset where asset.id = 
assetId);
+       
+       set tempPolicyCount = getTempPolicyCount(assetId, resId);
+       set currentTime = DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s");
+
+       set genPolicyName = concat(assetName, '-', tempPolicyCount, '-', 
currentTime);
+       set existPolId = (select id from x_resource where policy_name = 
genPolicyName);
+
+       if (existPolId != '') then
+               set genPolicyName = concat(assetName, '-', totalPolicyCount, 
'-', currentTime);
+       end if;
+
+       if(done = 1) then
+               LEAVE iLoop;
+       end if;
+
+       UPDATE x_resource set policy_name = genPolicyName where id = resId;
+
+       -- Creating Trx Log
+       set createTime = utc_timestamp();
+       set addedById = 1;
+       set classType = 1001;
+       set objId = resId;
+       set parentObjId = assetId;
+       set parentObjClsType = 1000;
+       set objName = resourceName;
+       set attrName = 'Policy Name';
+       set prevVal = null;
+       set newVal = genPolicyName;
+       set act = 'update';
+       set sessType = 'DB Script';
+       set parentObjName = assetName;
+
+       set transId = concat(DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s"), '_', 
rand());
+
+       insert into x_trx_log (create_time, update_time, added_by_id, 
upd_by_id, 
+               class_type, object_id, parent_object_id, 
parent_object_class_type, 
+               parent_object_name, object_name, attr_name, prev_val, new_val, 
`action`, 
+               trx_id, sess_type) 
+               values(createTime, createTime, addedById, addedById, classType, 
objId, 
+               parentObjId, parentObjClsType, parentObjName, objName, 
attrName, prevVal, 
+               newVal, act, transId, sessType);
+
+       insert into x_trx_log (create_time, update_time, added_by_id, 
upd_by_id, 
+               class_type, object_id, parent_object_id, 
parent_object_class_type, 
+               parent_object_name, object_name, attr_name, prev_val, new_val, 
`action`, 
+               trx_id, sess_type) 
+               values(createTime, createTime, addedById, addedById, classType, 
objId, 
+               parentObjId, parentObjClsType, parentObjName, objName, 
'Repository Type', prevVal, 
+               assetType, act, transId, sessType);     
+       
+       END LOOP;
+
+CLOSE policyList;
+
+END $$
+DELIMITER ;
+call updateBlankPolicyName();
+
+DROP FUNCTION if exists getTempPolicyCount;
+DROP PROCEDURE if exists updateBlankPolicyName;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/008-removeTrailingSlash.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/008-removeTrailingSlash.sql 
b/security-admin/db/mysql/patches/008-removeTrailingSlash.sql
new file mode 100644
index 0000000..2e00f5f
--- /dev/null
+++ b/security-admin/db/mysql/patches/008-removeTrailingSlash.sql
@@ -0,0 +1,144 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- 
--------------------------------------------------------------------------------
+-- Routine DDL
+-- Note: comments before and after the routine body will not be stored by the 
server
+-- 
--------------------------------------------------------------------------------
+DELIMITER $$
+
+DROP FUNCTION if exists removeTrailingSlash $$
+CREATE FUNCTION `removeTrailingSlash`(resName varchar(4000), resId bigint, 
assetId bigint, policyName varchar(1000)) RETURNS varchar(4000) CHARSET latin1
+BEGIN
+
+DECLARE noOfCommas int;
+DECLARE updatedResName varchar(4000) default '';
+DECLARE resource varchar(1000);
+DECLARE count int default 0;
+DECLARE proceedLoop boolean default true;
+
+-- TrxLog fields
+DECLARE createTime datetime;
+DECLARE addedById bigint;
+DECLARE classType int;
+DECLARE objId bigint;
+DECLARE parentObjId bigint;
+DECLARE parentObjClsType int;
+DECLARE parentObjName varchar(1024);
+DECLARE objName varchar(1024);
+DECLARE attrName varchar(255);
+DECLARE prevVal varchar(1024);
+DECLARE newVal varchar(1024);
+DECLARE trxId varchar(1024);
+DECLARE act varchar(255);
+DECLARE sessType varchar(30);
+DECLARE transId varchar(50);
+DECLARE assetTypeInt int;
+DECLARE assetType varchar(30);
+
+set noOfCommas = (LENGTH(resName)-LENGTH(REPLACE (resName, ",", "")));
+set assetTypeInt = (select asset_type from x_asset where id = assetId);
+
+       if (assetTypeInt = 1) then
+               set assetType = 'HDFS';
+       elseif  (assetTypeInt = 2) then
+               set assetType = 'HBase';
+       elseif ((assetTypeInt = 3)) then
+               set assetType = 'Hive';
+       elseif (assetTypeInt = 4) then
+               set assetType = 'XAAGENT';
+       elseif (assetTypeInt = 5) then
+               set assetType = 'Knox';
+       elseif (assetTypeInt = 6) then
+               set assetType = 'Storm';
+       end if;
+
+WHILE proceedLoop DO
+       set count = count +1;
+       
+       if (count > noOfCommas) then
+               set resource = SUBSTRING_INDEX(resName, ',', -1);
+               set proceedLoop = false;
+       else 
+               set resource = REPLACE(SUBSTRING(SUBSTRING_INDEX(resName, ',', 
count), 
+                                               LENGTH(SUBSTRING_INDEX(resName, 
',', count -1)) + 1), ',', '');
+       end if;
+
+       if (LENGTH(resource) > 1 && SUBSTRING(resource, 
-(LENGTH(resource)-(LENGTH(resource)-1))) = '/') then 
+               set resource = SUBSTRING(resource, 1, (LENGTH(resource)-1));
+       else
+               set resource = resource;
+       end if;
+
+       if(updatedResName != '') then
+               set updatedResName = CONCAT(updatedResName, ',', resource);
+       else
+               set updatedResName = resource;
+       end if;
+       
+END WHILE;
+
+if (updatedResName != resName) then
+-- Generating Trx Log if value has been updated.
+
+set createTime = utc_timestamp();
+set addedById = 1;
+set classType = 1001;
+set objId = resId;
+set parentObjId = assetId;
+set parentObjClsType = 1000;
+set objName = updatedResName;
+set attrName = 'Resource Path';
+set prevVal = resName;
+set newVal = updatedResName;
+set act = 'update';
+set sessType = 'DB Script';
+
+set parentObjName = (select asset_name from x_asset where id = assetId);
+set transId = concat(DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s"), '_', 
rand());
+
+insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id, 
+       class_type, object_id, parent_object_id, parent_object_class_type, 
+       parent_object_name, object_name, attr_name, prev_val, new_val, 
`action`, 
+       trx_id, sess_type) 
+       values(createTime, createTime, addedById, addedById, classType, objId, 
+       parentObjId, parentObjClsType, parentObjName, objName, attrName, 
prevVal, 
+       newVal, act, transId, sessType);
+
+insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id, 
+       class_type, object_id, parent_object_id, parent_object_class_type, 
+       parent_object_name, object_name, attr_name, prev_val, new_val, 
`action`, 
+       trx_id, sess_type) 
+       values(createTime, createTime, addedById, addedById, classType, objId, 
+       parentObjId, parentObjClsType, parentObjName, objName, 'Policy Name', 
policyName, 
+       policyName, act, transId, sessType);
+
+insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id, 
+       class_type, object_id, parent_object_id, parent_object_class_type, 
+       parent_object_name, object_name, attr_name, new_val, `action`, 
+       trx_id, sess_type) 
+       values(createTime, createTime, addedById, addedById, classType, objId, 
+       parentObjId, parentObjClsType, parentObjName, objName, 'Repository 
Type', 
+       assetType, act, transId, sessType);
+
+end if;
+
+RETURN updatedResName;
+END $$
+DELIMITER ;
+UPDATE x_resource res, x_asset asset set res_name = 
removeTrailingSlash(res.res_name, res.id, res.asset_id, res.policy_name) 
+       WHERE asset.asset_type = 1 and asset.id = res.asset_id;
+
+DROP FUNCTION if exists removeTrailingSlash;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/009-updated_schema.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/009-updated_schema.sql 
b/security-admin/db/mysql/patches/009-updated_schema.sql
new file mode 100644
index 0000000..ef1c1ed
--- /dev/null
+++ b/security-admin/db/mysql/patches/009-updated_schema.sql
@@ -0,0 +1,416 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+DROP TABLE IF EXISTS `x_service_def`;
+CREATE TABLE `x_service_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`version` bigint(20) DEFAULT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`impl_class_name` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_description` varchar(1024) DEFAULT NULL,
+`is_enabled` tinyint DEFAULT 1,
+primary key (`id`),
+KEY `x_service_def_added_by_id` (`added_by_id`),
+KEY `x_service_def_upd_by_id` (`upd_by_id`),
+KEY `x_service_def_cr_time` (`create_time`),
+KEY `x_service_def_up_time` (`update_time`),
+CONSTRAINT `x_service_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_service`;
+CREATE TABLE `x_service`(
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`version` bigint(20) DEFAULT NULL,
+`type` bigint(20) DEFAULT NULL,
+`name` varchar(512) DEFAULT NULL,
+`policy_version` bigint(20) DEFAULT NULL,
+`policy_update_time`datetime DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`is_enabled` tinyint(1) NOT NULL DEFAULT '0',
+primary key (`id`),
+UNIQUE KEY `X_service_name` (`name`),
+KEY `x_service_added_by_id` (`added_by_id`),
+KEY `x_service_upd_by_id` (`upd_by_id`),
+KEY `x_service_cr_time` (`create_time`),
+KEY `x_service_up_time` (`update_time`),
+KEY `x_service_type` (`type`),
+CONSTRAINT `x_service_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+CONSTRAINT `x_service_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`),
+CONSTRAINT `x_service_FK_type` FOREIGN KEY (`type`) REFERENCES `x_service_def` 
(`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy`;
+CREATE TABLE `x_policy` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`version` bigint(20) DEFAULT NULL,
+`service` bigint(20) DEFAULT NULL,
+`name` varchar(512) DEFAULT NULL, 
+`description` varchar(1024) DEFAULT NULL,
+`is_enabled` tinyint(1) NOT NULL DEFAULT '0',
+`is_audit_enabled` tinyint(1) NOT NULL DEFAULT '0',
+primary key (`id`),
+UNIQUE KEY `x_policy_name` (`name`), 
+KEY `x_policy_added_by_id` (`added_by_id`),
+KEY `x_policy_upd_by_id` (`upd_by_id`),
+KEY `x_policy_cr_time` (`create_time`),
+KEY `x_policy_up_time` (`update_time`),
+KEY `x_policy_service` (`service`),    
+CONSTRAINT `x_policy_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+CONSTRAINT `x_policy_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`),
+CONSTRAINT `x_policy_FK_service` FOREIGN KEY (`service`) REFERENCES 
`x_service` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_service_config_def`;
+CREATE TABLE `x_service_config_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`type` varchar(1024) DEFAULT NULL,
+`sub_type` varchar(1024) DEFAULT NULL,
+`is_mandatory` tinyint(1) NOT NULL DEFAULT '0',
+`default_value` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_decription` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_service_conf_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES 
`x_service_def` (`id`),
+CONSTRAINT `x_service_conf_def_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_conf_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_resource_def`;
+CREATE TABLE `x_resource_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`type` varchar(1024) DEFAULT NULL,
+`res_level` bigint(20) DEFAULT NULL,
+`parent` bigint(20) DEFAULT NULL,
+`mandatory` tinyint(1) NOT NULL DEFAULT '0',
+`look_up_supported` tinyint(1) NOT NULL DEFAULT '0',
+`recursive_supported` tinyint(1) NOT NULL DEFAULT '0',
+`excludes_supported` tinyint(1) NOT NULL DEFAULT '0',
+`matcher` varchar(1024) DEFAULT NULL,
+`matcher_options` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_description` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+KEY `x_resource_def_FK_parent` (`parent`),
+CONSTRAINT `x_resource_def_FK_parent` FOREIGN KEY (`parent`) REFERENCES 
`x_resource_def` (`id`),
+CONSTRAINT `x_resource_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES 
`x_service_def` (`id`),
+CONSTRAINT `x_resource_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_resource_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_access_type_def`;
+CREATE TABLE `x_access_type_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_access_type_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES 
`x_service_def` (`id`),
+CONSTRAINT `x_access_type_def_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_access_type_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_access_type_def_grants`;
+CREATE TABLE `x_access_type_def_grants` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`atd_id` bigint(20) NOT NULL,
+`implied_grant` varchar(1024) DEFAULT NULL,
+primary key (`id`),
+CONSTRAINT `x_atd_grants_FK_atdid` FOREIGN KEY (`atd_id`) REFERENCES 
`x_access_type_def` (`id`),
+CONSTRAINT `x_atd_grants_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_atd_grants_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy_condition_def`;
+CREATE TABLE `x_policy_condition_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`evaluator` varchar(1024) DEFAULT NULL,
+`evaluator_options` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_description` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_cond_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES 
`x_service_def` (`id`),
+CONSTRAINT `x_policy_cond_def_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_cond_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_enum_def`;
+CREATE TABLE `x_enum_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`def_id` bigint(20) NOT NULL, 
+`name` varchar(1024) DEFAULT NULL,
+`default_index` bigint(20) DEFAULT NULL,
+primary key (`id`),
+CONSTRAINT `x_enum_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES 
`x_service_def` (`id`),
+CONSTRAINT `x_enum_def_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+CONSTRAINT `x_enum_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_enum_element_def`;
+CREATE TABLE `x_enum_element_def` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`enum_def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_enum_element_def_FK_defid` FOREIGN KEY (`enum_def_id`) 
REFERENCES `x_enum_def` (`id`),
+CONSTRAINT `x_enum_element_def_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_enum_element_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_service_config_map`;
+CREATE TABLE `x_service_config_map` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`service` bigint(20) NOT NULL, 
+`config_key` varchar(1024) DEFAULT NULL,
+`config_value` varchar(1024) DEFAULT NULL,
+primary key (`id`),
+CONSTRAINT `x_service_conf_map_FK_service` FOREIGN KEY (`service`) REFERENCES 
`x_service` (`id`),
+CONSTRAINT `x_service_conf_map_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_conf_map_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_resource`;
+CREATE TABLE `x_policy_resource` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`policy_id` bigint(20) NOT NULL, 
+`res_def_id` bigint(20) NOT NULL, 
+`is_excludes` tinyint(1) NOT NULL DEFAULT '0',
+`is_recursive` tinyint(1) NOT NULL DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_res_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES 
`x_policy` (`id`), 
+CONSTRAINT `x_policy_res_FK_res_def_id` FOREIGN KEY (`res_def_id`) REFERENCES 
`x_resource_def` (`id`),
+CONSTRAINT `x_policy_res_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_res_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_resource_map`;
+CREATE TABLE `x_policy_resource_map` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`resource_id` bigint(20) NOT NULL,
+`value` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_res_map_FK_res_id` FOREIGN KEY (`resource_id`) REFERENCES 
`x_policy_resource` (`id`),
+CONSTRAINT `x_policy_res_map_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_res_map_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+
+DROP TABLE IF EXISTS `x_policy_item`;
+CREATE TABLE `x_policy_item` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`policy_id` bigint(20) NOT NULL,
+`delegate_admin` tinyint(1) NOT NULL DEFAULT '0',
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`), 
+CONSTRAINT `x_policy_item_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES 
`x_policy` (`id`),
+CONSTRAINT `x_policy_item_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_item_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_item_access`;
+CREATE TABLE `x_policy_item_access` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`policy_item_id` bigint(20) NOT NULL, 
+`type` bigint(20) NOT NULL,
+`is_allowed` tinyint(3) NOT NULL DEFAULT '0',
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (id), 
+CONSTRAINT `x_plc_item_access_FK_pi_id` FOREIGN KEY (`policy_item_id`) 
REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_item_access_FK_atd_id` FOREIGN KEY (`type`) REFERENCES 
`x_access_type_def` (`id`),
+CONSTRAINT `x_plc_item_access_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_item_access_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy_item_condition`;
+CREATE TABLE `x_policy_item_condition` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`policy_item_id` bigint(20) NOT NULL, 
+`type` bigint(20) NOT NULL,
+`value` varchar(1024) DEFAULT NULL, 
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (id), 
+CONSTRAINT `x_plc_item_cond_FK_pi_id` FOREIGN KEY (`policy_item_id`) 
REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_item_cond_FK_pcd_id` FOREIGN KEY (`type`) REFERENCES 
`x_policy_condition_def` (`id`),
+CONSTRAINT `x_plc_item_cond_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_item_cond_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy_item_user_perm`;
+CREATE TABLE `x_policy_item_user_perm` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`policy_item_id` bigint(20) NOT NULL,
+`user_id` bigint(20) NULL DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`), 
+CONSTRAINT `x_plc_itm_usr_perm_FK_pi_id` FOREIGN KEY (`policy_item_id`) 
REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES 
`x_user` (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_item_group_perm`;
+CREATE TABLE `x_policy_item_group_perm` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`guid` varchar(1024) DEFAULT NULL,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`added_by_id` bigint(20) DEFAULT NULL,
+`upd_by_id` bigint(20) DEFAULT NULL,
+`policy_item_id` bigint(20) NOT NULL,
+`group_id` bigint(20) NULL DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`), 
+CONSTRAINT `x_plc_itm_grp_perm_FK_pi_id` FOREIGN KEY (`policy_item_id`) 
REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_group_id` FOREIGN KEY (`group_id`) 
REFERENCES `x_group` (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_added_by` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_data_hist`;
+CREATE TABLE `x_data_hist` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`obj_guid` varchar(1024) not null,
+`obj_class_type` int NOT NULL,
+`obj_id` bigint(20) not null,
+`obj_name` varchar(1024) NOT NULL,
+`version` bigint(20) DEFAULT NULL,
+`action` varchar(512) NOT NULL,
+`from_time` datetime NOT NULL,
+`to_time` datetime DEFAULT NULL,
+`content` text NOT NULL,
+primary key (`id`)
+);
+

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/reset_asset.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/reset_asset.sql 
b/security-admin/db/mysql/reset_asset.sql
new file mode 100644
index 0000000..1d53819
--- /dev/null
+++ b/security-admin/db/mysql/reset_asset.sql
@@ -0,0 +1,19 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+update x_asset set config = 
'{"username":"policymgr","password":"policymgr","fs.default.name":"hdfs://sandbox.hortonworks.com:8020","hadoop.security.authorization":"false","hadoop.security.authentication":"simple","hadoop.security.auth_to_local":"RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/
         RULE:[2:$1@$0](jhs@.*)s/.*/mapred/         
RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/         RULE:[2:$1@$0](hm@.*)s/.*/hbase/     
    RULE:[2:$1@$0](rs@.*)s/.*/hbase/         
DEFAULT","dfs.datanode.kerberos.principal":"","dfs.namenode.kerberos.principal":"","dfs.secondary.namenode.kerberos.principal":"","commonNameForCertificate":""}'
 where asset_name = 'hadoopdev';
+update x_asset set config = 
'{"username":"policymgr","password":"policymgr","fs.default.name":"hdfs://sandbox.hortonworks.com:8020","hadoop.security.authorization":"false","hadoop.security.authentication":"simple","hadoop.security.auth_to_local":"RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/
         RULE:[2:$1@$0](jhs@.*)s/.*/mapred/         
RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/         RULE:[2:$1@$0](hm@.*)s/.*/hbase/     
    RULE:[2:$1@$0](rs@.*)s/.*/hbase/         
DEFAULT","dfs.datanode.kerberos.principal":"","dfs.namenode.kerberos.principal":"","dfs.secondary.namenode.kerberos.principal":"","hbase.master.kerberos.principal":"","hbase.rpc.engine":"org.apache.hadoop.hbase.ipc.SecureRpcEngine","hbase.rpc.protection":"privacy","hbase.security.authentication":"simple","hbase.zookeeper.property.clientPort":"2181","hbase.zookeeper.quorum":"sandbox.hortonworks.com","commonNameForCertificate":""}'
 where asset_name = 'hbase' ;
+update x_asset set config = 
'{"username":"policymgr","password":"","jdbc.driverClassName":"org.apache.hive.jdbc.HiveDriver","jdbc.url":"jdbc:hive2://sandbox.hortonworks.com:10000/default","commonNameForCertificate":""}'
  where asset_name = 'dev-hive' ;
+commit ;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/reset_audit_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/reset_audit_mysql.sh 
b/security-admin/db/mysql/reset_audit_mysql.sh
new file mode 100755
index 0000000..51a5359
--- /dev/null
+++ b/security-admin/db/mysql/reset_audit_mysql.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Script to reset mysql database
+#
+
+#if [ $# -lt 1 ]; then
+#       echo "Usage: $0 <db_root_password> [db_host] <db_name>"
+#       exit 1
+#fi
+#
+#db_root_password=$1
+#db_host="localhost"
+#if [ "$2" != "" ]; then
+#    db_host="$2"
+#fi
+#db_name="xa_logger"
+#if [ "$3" != "" ]; then
+#    db_name="$3"
+#fi
+
+audit_db_user=xaadmin
+audit_db_password=xaadmin
+audit_db_file=xa_audit_db.sql
+audit_db_name=xa_logger
+echo "Importing database file $audit_db_file.sql ...  "
+set -x
+mysql -u $audit_db_user  --password=$audit_db_password  -e "create database IF 
NOT EXISTS $audit_db_name"
+mysql -u $audit_db_user  --password=$audit_db_password 
--database=$audit_db_name < $audit_db_file

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/reset_core_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/reset_core_mysql.sh 
b/security-admin/db/mysql/reset_core_mysql.sh
new file mode 100755
index 0000000..26f7d46
--- /dev/null
+++ b/security-admin/db/mysql/reset_core_mysql.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Script to reset mysql database
+#
+
+#if [ $# -lt 1 ]; then
+#       echo "Usage: $0 <db_root_password> [db_host] <db_name>"
+#       exit 1
+#fi
+#
+#db_root_password=$1
+#db_host="localhost"
+#if [ "$2" != "" ]; then
+#    db_host="$2"
+#fi
+#db_name="xa_db"
+#if [ "$3" != "" ]; then
+#    db_name="$3"
+#fi
+
+db_user=xaadmin
+db_password=xaadmin
+db_file=xa_core_db.sql
+db_name=xa_db
+
+echo "Importing database file $db_file.sql ...  "
+set -x
+mysql -u $db_user  --password=$db_password --database=$db_name < $db_file

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/resetdb_dev_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/resetdb_dev_mysql.sh 
b/security-admin/db/mysql/resetdb_dev_mysql.sh
new file mode 100755
index 0000000..c2bf5fb
--- /dev/null
+++ b/security-admin/db/mysql/resetdb_dev_mysql.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# 
+# Script to reset mysql database
+#
+
+#if [ $# -lt 1 ]; then
+#      echo "Usage: $0 <db_root_password> [db_host]"
+#      exit 1
+#fi
+#
+#db_root_password=$1
+#db_host="localhost"
+#if [ "$2" != "" ]; then
+#    db_host="$2"
+#fi
+
+db_user=xaadmin
+db_password=xaadmin
+db_file=xa_core_db.sql
+db_core_file=xa_core_db.sql
+db_name=xa_db
+
+MYSQL_BIN='mysql'
+MYSQL_HOST='localhost'
+
+mysqlexec="${MYSQL_BIN} -u ${db_user} --password=${db_password} -h 
${MYSQL_HOST} ${db_name}"
+
+
+#echo "Importing database file $db_file ...  "
+#set -x
+#mysql -u $db_user  --password=$db_password < $db_file
+
+
+log() {  
+   local prefix="[$(date +%Y/%m/%d\ %H:%M:%S)]: "
+   echo "${prefix} $@" 
+} 
+
+check_ret_status(){
+  if [ $1 -ne 0 ]; then
+    log "[E] $2"; 
+    exit 1; 
+  fi
+}
+
+import_db () {
+
+  log "[I] Verifying Database: $db_name";
+  existdb=`${MYSQL_BIN} -u ${db_user} --password=$db_password -h $MYSQL_HOST 
-B --skip-column-names -e  "show databases like '${db_name}' ;"`
+
+  if [ "${existdb}" = "${db_name}" ]
+  then
+    log "[I] - database ${db_name} already exists. deleting ..."
+    $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST -e "drop 
database $db_name"  
+
+  fi
+
+    log "[I] Creating Database: $db_name";
+    $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST -e "create 
database $db_name"  
+    check_ret_status $? "Creating database Failed.."
+  
+  
+    log "[I] Importing Core Database file: $db_core_file "
+      $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST $db_name < 
$db_core_file
+      check_ret_status $? "Importing Database Failed.."
+  
+    log "[I] Importing Database file : $db_core_file DONE";
+}
+
+run_patches(){
+  log "[I] - starting upgradedb ... "
+
+  DBVERSION_CATALOG_CREATION=create_dbversion_catalog.sql
+
+  mysqlexec="${MYSQL_BIN} -u ${db_user} --password=${db_password} -h 
${MYSQL_HOST} ${db_name}"
+  
+  if [ -f ${DBVERSION_CATALOG_CREATION} ]
+  then
+    log "[I] Verifying database version catalog table .... "
+    ${mysqlexec} < ${DBVERSION_CATALOG_CREATION} 
+  fi
+    
+  dt=`date '+%s'`
+  tempFile=/tmp/sql_${dt}_$$.sql
+  sqlfiles=`ls -1 patches/*.sql 2> /dev/null | awk -F/ '{ print $NF }' | awk 
-F- '{ print $1, $0 }' | sort -k1 -n | awk '{ printf("patches/%s\n",$2) ; }'`
+  for sql in ${sqlfiles}
+  do
+    if [ -f ${sql} ]
+    then
+      bn=`basename ${sql}`
+      version=`echo ${bn} | awk -F'-' '{ print $1 }'`
+      if [ "${version}" != "" ]
+      then
+        c=`${mysqlexec} -B --skip-column-names -e "select count(id) from 
x_db_version_h where version = '${version}' and active = 'Y'"`
+        check_ret_status $? "DBVerionCheck - ${version} Failed."
+        if [ ${c} -eq 0 ]
+        then
+          cat ${sql} > ${tempFile}
+          echo >> ${tempFile}
+          echo "insert into x_db_version_h (version, inst_at, inst_by, 
updated_at, updated_by) values ( '${version}', now(), user(), now(), user()) ;" 
>> ${tempFile}
+          log "[I] - patch [${version}] is being applied."
+          ${mysqlexec} < ${tempFile}
+          check_ret_status $? "Update patch - ${version} Failed. See sql file 
: [${tempFile}]"
+          rm -f ${tempFile}
+        else
+          log "[I] - patch [${version}] is already applied. Skipping ..."
+        fi
+      fi
+    fi
+  done
+}
+
+
+import_db
+run_patches   
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/xa_audit_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/xa_audit_db.sql 
b/security-admin/db/mysql/xa_audit_db.sql
new file mode 100644
index 0000000..dba98ce
--- /dev/null
+++ b/security-admin/db/mysql/xa_audit_db.sql
@@ -0,0 +1,82 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- MySQL dump 10.13  Distrib 5.1.50, for apple-darwin10.3.0 (i386)
+--
+-- Host: localhost    Database: xa_db
+-- ------------------------------------------------------
+-- Server version      5.1.50
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, 
FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `xa_access_audit`
+--
+
+DROP TABLE IF EXISTS `xa_access_audit`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `xa_access_audit` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `audit_type` int(11) NOT NULL DEFAULT '0',
+  `access_result` int(11) DEFAULT '0',
+  `access_type` varchar(255) DEFAULT NULL,
+  `acl_enforcer` varchar(255) DEFAULT NULL,
+  `agent_id` varchar(255) DEFAULT NULL,
+  `client_ip` varchar(255) DEFAULT NULL,
+  `client_type` varchar(255) DEFAULT NULL,
+  `policy_id` bigint(20) DEFAULT '0',
+  `repo_name` varchar(255) DEFAULT NULL,
+  `repo_type` int(11) DEFAULT '0',
+  `result_reason` varchar(255) DEFAULT NULL,
+  `session_id` varchar(255) DEFAULT NULL,
+  `event_time` datetime DEFAULT NULL,
+  `request_user` varchar(255) DEFAULT NULL,
+  `action` varchar(2000) DEFAULT NULL,
+  `request_data` varchar(2000) DEFAULT NULL,
+  `resource_path` varchar(2000) DEFAULT NULL,
+  `resource_type` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `xa_access_audit_added_by_id` (`added_by_id`),
+  KEY `xa_access_audit_upd_by_id` (`upd_by_id`),
+  KEY `xa_access_audit_cr_time` (`create_time`),
+  KEY `xa_access_audit_up_time` (`update_time`),
+  KEY `xa_access_audit_event_time` (`event_time`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `xa_access_audit`
+--
+
+LOCK TABLES `xa_access_audit` WRITE;
+/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+-- Dump completed on 2014-05-25  0:07:27

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/xa_core_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/xa_core_db.sql 
b/security-admin/db/mysql/xa_core_db.sql
new file mode 100644
index 0000000..9d889a0
--- /dev/null
+++ b/security-admin/db/mysql/xa_core_db.sql
@@ -0,0 +1,754 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- MySQL dump 10.13  Distrib 5.1.50, for apple-darwin10.3.0 (i386)
+--
+-- Host: localhost    Database: xa_db
+-- ------------------------------------------------------
+-- Server version      5.1.50
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, 
FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Temporary table structure for view `vx_trx_log`
+--
+
+DROP TABLE IF EXISTS `vx_trx_log`;
+/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `vx_trx_log` (
+  `id` bigint(20),
+  `create_time` datetime,
+  `update_time` datetime,
+  `added_by_id` bigint(20),
+  `upd_by_id` bigint(20),
+  `class_type` int(11),
+  `object_id` bigint(20),
+  `parent_object_id` bigint(20),
+  `parent_object_class_type` int(11),
+  `attr_name` varchar(255),
+  `parent_object_name` varchar(1024),
+  `object_name` varchar(1024),
+  `prev_val` varchar(1024),
+  `new_val` varchar(1024),
+  `trx_id` varchar(1024),
+  `action` varchar(255),
+  `sess_id` varchar(512),
+  `req_id` varchar(30),
+  `sess_type` varchar(30)
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `x_asset`
+--
+
+DROP TABLE IF EXISTS `x_asset`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_asset` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `asset_name` varchar(1024) NOT NULL,
+  `descr` varchar(4000) NOT NULL,
+  `act_status` int(11) NOT NULL DEFAULT '0',
+  `asset_type` int(11) NOT NULL DEFAULT '0',
+  `config` text,
+  `sup_native` tinyint(1) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `x_asset_FK_added_by_id` (`added_by_id`),
+  KEY `x_asset_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_asset_cr_time` (`create_time`),
+  KEY `x_asset_up_time` (`update_time`),
+  CONSTRAINT `x_asset_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_asset_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_asset`
+--
+
+LOCK TABLES `x_asset` WRITE;
+/*!40000 ALTER TABLE `x_asset` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_asset` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_audit_map`
+--
+
+DROP TABLE IF EXISTS `x_audit_map`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_audit_map` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `res_id` bigint(20) DEFAULT NULL,
+  `group_id` bigint(20) DEFAULT NULL,
+  `user_id` bigint(20) DEFAULT NULL,
+  `audit_type` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `x_audit_map_FK_added_by_id` (`added_by_id`),
+  KEY `x_audit_map_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_audit_map_FK_res_id` (`res_id`),
+  KEY `x_audit_map_FK_group_id` (`group_id`),
+  KEY `x_audit_map_FK_user_id` (`user_id`),
+  KEY `x_audit_map_cr_time` (`create_time`),
+  KEY `x_audit_map_up_time` (`update_time`),
+  CONSTRAINT `x_audit_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_audit_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES 
`x_group` (`id`),
+  CONSTRAINT `x_audit_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES 
`x_resource` (`id`),
+  CONSTRAINT `x_audit_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_audit_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES 
`x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_audit_map`
+--
+
+LOCK TABLES `x_audit_map` WRITE;
+/*!40000 ALTER TABLE `x_audit_map` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_audit_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_auth_sess`
+--
+
+DROP TABLE IF EXISTS `x_auth_sess`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_auth_sess` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `login_id` varchar(767) NOT NULL,
+  `user_id` bigint(20) DEFAULT NULL,
+  `ext_sess_id` varchar(512) DEFAULT NULL,
+  `auth_time` datetime NOT NULL,
+  `auth_status` int(11) NOT NULL DEFAULT '0',
+  `auth_type` int(11) NOT NULL DEFAULT '0',
+  `auth_provider` int(11) NOT NULL DEFAULT '0',
+  `device_type` int(11) NOT NULL DEFAULT '0',
+  `req_ip` varchar(48) NOT NULL,
+  `req_ua` varchar(1024) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_auth_sess_FK_added_by_id` (`added_by_id`),
+  KEY `x_auth_sess_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_auth_sess_FK_user_id` (`user_id`),
+  KEY `x_auth_sess_cr_time` (`create_time`),
+  KEY `x_auth_sess_up_time` (`update_time`),
+  CONSTRAINT `x_auth_sess_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_auth_sess_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_auth_sess_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_auth_sess`
+--
+
+LOCK TABLES `x_auth_sess` WRITE;
+/*!40000 ALTER TABLE `x_auth_sess` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_auth_sess` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_cred_store`
+--
+
+DROP TABLE IF EXISTS `x_cred_store`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_cred_store` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `store_name` varchar(1024) NOT NULL,
+  `descr` varchar(4000) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_cred_store_FK_added_by_id` (`added_by_id`),
+  KEY `x_cred_store_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_cred_store_cr_time` (`create_time`),
+  KEY `x_cred_store_up_time` (`update_time`),
+  CONSTRAINT `x_cred_store_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_cred_store_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_cred_store`
+--
+
+LOCK TABLES `x_cred_store` WRITE;
+/*!40000 ALTER TABLE `x_cred_store` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_cred_store` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_db_base`
+--
+
+DROP TABLE IF EXISTS `x_db_base`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_db_base` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_db_base_FK_added_by_id` (`added_by_id`),
+  KEY `x_db_base_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_db_base_cr_time` (`create_time`),
+  KEY `x_db_base_up_time` (`update_time`),
+  CONSTRAINT `x_db_base_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_db_base_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_db_base`
+--
+
+LOCK TABLES `x_db_base` WRITE;
+/*!40000 ALTER TABLE `x_db_base` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_db_base` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group`
+--
+
+DROP TABLE IF EXISTS `x_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `group_name` varchar(1024) NOT NULL,
+  `descr` varchar(4000) NOT NULL,
+  `status` int(11) NOT NULL DEFAULT '0',
+  `group_type` int(11) NOT NULL DEFAULT '0',
+  `cred_store_id` bigint(20) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_group_FK_added_by_id` (`added_by_id`),
+  KEY `x_group_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_group_FK_cred_store_id` (`cred_store_id`),
+  KEY `x_group_cr_time` (`create_time`),
+  KEY `x_group_up_time` (`update_time`),
+  CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_group_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) 
REFERENCES `x_cred_store` (`id`),
+  CONSTRAINT `x_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group`
+--
+
+LOCK TABLES `x_group` WRITE;
+/*!40000 ALTER TABLE `x_group` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group_groups`
+--
+
+DROP TABLE IF EXISTS `x_group_groups`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group_groups` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `group_name` varchar(1024) NOT NULL,
+  `p_group_id` bigint(20) DEFAULT NULL,
+  `group_id` bigint(20) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_group_groups_FK_added_by_id` (`added_by_id`),
+  KEY `x_group_groups_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_group_groups_FK_p_group_id` (`p_group_id`),
+  KEY `x_group_groups_FK_group_id` (`group_id`),
+  KEY `x_group_groups_cr_time` (`create_time`),
+  KEY `x_group_groups_up_time` (`update_time`),
+  CONSTRAINT `x_group_groups_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_group_groups_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES 
`x_group` (`id`),
+  CONSTRAINT `x_group_groups_FK_p_group_id` FOREIGN KEY (`p_group_id`) 
REFERENCES `x_group` (`id`),
+  CONSTRAINT `x_group_groups_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) 
REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group_groups`
+--
+
+LOCK TABLES `x_group_groups` WRITE;
+/*!40000 ALTER TABLE `x_group_groups` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group_groups` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group_users`
+--
+
+DROP TABLE IF EXISTS `x_group_users`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group_users` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `group_name` varchar(1024) NOT NULL,
+  `p_group_id` bigint(20) DEFAULT NULL,
+  `user_id` bigint(20) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_group_users_FK_added_by_id` (`added_by_id`),
+  KEY `x_group_users_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_group_users_FK_p_group_id` (`p_group_id`),
+  KEY `x_group_users_FK_user_id` (`user_id`),
+  KEY `x_group_users_cr_time` (`create_time`),
+  KEY `x_group_users_up_time` (`update_time`),
+  CONSTRAINT `x_group_users_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_group_users_FK_p_group_id` FOREIGN KEY (`p_group_id`) 
REFERENCES `x_group` (`id`),
+  CONSTRAINT `x_group_users_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_group_users_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES 
`x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group_users`
+--
+
+LOCK TABLES `x_group_users` WRITE;
+/*!40000 ALTER TABLE `x_group_users` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group_users` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_perm_map`
+--
+
+DROP TABLE IF EXISTS `x_perm_map`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_perm_map` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `perm_group` varchar(1024) DEFAULT NULL,
+  `res_id` bigint(20) DEFAULT NULL,
+  `group_id` bigint(20) DEFAULT NULL,
+  `user_id` bigint(20) DEFAULT NULL,
+  `perm_for` int(11) NOT NULL DEFAULT '0',
+  `perm_type` int(11) NOT NULL DEFAULT '0',
+  `is_recursive` int(11) NOT NULL DEFAULT '0',
+  `is_wild_card` tinyint(1) NOT NULL DEFAULT '1',
+  `grant_revoke` tinyint(1) NOT NULL DEFAULT '1',
+  PRIMARY KEY (`id`),
+  KEY `x_perm_map_FK_added_by_id` (`added_by_id`),
+  KEY `x_perm_map_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_perm_map_FK_res_id` (`res_id`),
+  KEY `x_perm_map_FK_group_id` (`group_id`),
+  KEY `x_perm_map_FK_user_id` (`user_id`),
+  KEY `x_perm_map_cr_time` (`create_time`),
+  KEY `x_perm_map_up_time` (`update_time`),
+  CONSTRAINT `x_perm_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES 
`x_group` (`id`),
+  CONSTRAINT `x_perm_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES 
`x_resource` (`id`),
+  CONSTRAINT `x_perm_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_perm_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES 
`x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_perm_map`
+--
+
+LOCK TABLES `x_perm_map` WRITE;
+/*!40000 ALTER TABLE `x_perm_map` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_perm_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_policy_export_audit`
+--
+
+DROP TABLE IF EXISTS `x_policy_export_audit`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_policy_export_audit` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `client_ip` varchar(255) NOT NULL,
+  `agent_id` varchar(255) DEFAULT NULL,
+  `req_epoch` bigint(20) NOT NULL,
+  `last_updated` datetime DEFAULT NULL,
+  `repository_name` varchar(1024) DEFAULT NULL,
+  `exported_json` text,
+  `http_ret_code` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `x_policy_export_audit_FK_added_by_id` (`added_by_id`),
+  KEY `x_policy_export_audit_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_policy_export_audit_cr_time` (`create_time`),
+  KEY `x_policy_export_audit_up_time` (`update_time`),
+  CONSTRAINT `x_policy_export_audit_FK_added_by_id` FOREIGN KEY 
(`added_by_id`) REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_policy_export_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) 
REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_policy_export_audit`
+--
+
+LOCK TABLES `x_policy_export_audit` WRITE;
+/*!40000 ALTER TABLE `x_policy_export_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_policy_export_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_portal_user`
+--
+
+DROP TABLE IF EXISTS `x_portal_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_portal_user` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `first_name` varchar(1022) DEFAULT NULL,
+  `last_name` varchar(1022) DEFAULT NULL,
+  `pub_scr_name` varchar(2048) DEFAULT NULL,
+  `login_id` varchar(767) DEFAULT NULL,
+  `password` varchar(512) NOT NULL,
+  `email` varchar(512) DEFAULT NULL,
+  `status` int(11) NOT NULL DEFAULT '0',
+  `user_src` int(11) NOT NULL DEFAULT '0',
+  `notes` varchar(4000) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
+  UNIQUE KEY `x_portal_user_UK_email` (`email`),
+  KEY `x_portal_user_FK_added_by_id` (`added_by_id`),
+  KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_portal_user_cr_time` (`create_time`),
+  KEY `x_portal_user_up_time` (`update_time`),
+  KEY `x_portal_user_name` (`first_name`(767)),
+  KEY `x_portal_user_email` (`email`),
+  CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_portal_user`
+--
+
+LOCK TABLES `x_portal_user` WRITE;
+/*!40000 ALTER TABLE `x_portal_user` DISABLE KEYS */;
+INSERT INTO `x_portal_user` VALUES (1,'2014-05-25 00:07:26','2014-05-25 
00:07:26',NULL,NULL,'Admin','','Admin','admin','ceb4f32325eda6142bd65215f4c0f371','',1,0,NULL);
+/*!40000 ALTER TABLE `x_portal_user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_portal_user_role`
+--
+
+DROP TABLE IF EXISTS `x_portal_user_role`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_portal_user_role` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `user_id` bigint(20) NOT NULL,
+  `user_role` varchar(128) DEFAULT NULL,
+  `status` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `x_portal_user_role_FK_added_by_id` (`added_by_id`),
+  KEY `x_portal_user_role_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_portal_user_role_FK_user_id` (`user_id`),
+  KEY `x_portal_user_role_cr_time` (`create_time`),
+  KEY `x_portal_user_role_up_time` (`update_time`),
+  CONSTRAINT `x_portal_user_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_portal_user_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) 
REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_portal_user_role`
+--
+
+LOCK TABLES `x_portal_user_role` WRITE;
+/*!40000 ALTER TABLE `x_portal_user_role` DISABLE KEYS */;
+INSERT INTO `x_portal_user_role` VALUES (1,'2014-05-25 00:07:26','2014-05-25 
00:07:26',NULL,NULL,1,'ROLE_SYS_ADMIN',1);
+/*!40000 ALTER TABLE `x_portal_user_role` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_resource`
+--
+
+DROP TABLE IF EXISTS `x_resource`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_resource` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `res_name` varchar(4000) DEFAULT NULL,
+  `descr` varchar(4000) DEFAULT NULL,
+  `res_type` int(11) NOT NULL DEFAULT '0',
+  `asset_id` bigint(20) NOT NULL,
+  `parent_id` bigint(20) DEFAULT NULL,
+  `parent_path` varchar(4000) DEFAULT NULL,
+  `is_encrypt` int(11) NOT NULL DEFAULT '0',
+  `is_recursive` int(11) NOT NULL DEFAULT '0',
+  `res_group` varchar(1024) DEFAULT NULL,
+  `res_dbs` text,
+  `res_tables` text,
+  `res_col_fams` text,
+  `res_cols` text,
+  `res_udfs` text,
+  `res_status` int(11) NOT NULL DEFAULT '1',
+  `table_type` int(11) NOT NULL DEFAULT '0',
+  `col_type` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `x_resource_FK_added_by_id` (`added_by_id`),
+  KEY `x_resource_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_resource_FK_asset_id` (`asset_id`),
+  KEY `x_resource_FK_parent_id` (`parent_id`),
+  KEY `x_resource_cr_time` (`create_time`),
+  KEY `x_resource_up_time` (`update_time`),
+  CONSTRAINT `x_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) 
REFERENCES `x_portal_user` (`id`),
+  CONSTRAINT `x_resource_FK_asset_id` FOREIGN KEY (`asset_id`) REFERENCES 
`x_asset` (`id`),
+  CONSTRAINT `x_resource_FK_parent_id` FOREIGN KEY (`parent_id`) REFERENCES 
`x_resource` (`id`),
+  CONSTRAINT `x_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_resource`
+--
+
+LOCK TABLES `x_resource` WRITE;
+/*!40000 ALTER TABLE `x_resource` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_resource` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_trx_log`
+--
+
+DROP TABLE IF EXISTS `x_trx_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_trx_log` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `class_type` int(11) NOT NULL DEFAULT '0',
+  `object_id` bigint(20) DEFAULT NULL,
+  `parent_object_id` bigint(20) DEFAULT NULL,
+  `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
+  `parent_object_name` varchar(1024) DEFAULT NULL,
+  `object_name` varchar(1024) DEFAULT NULL,
+  `attr_name` varchar(255) DEFAULT NULL,
+  `prev_val` varchar(1024) DEFAULT NULL,
+  `new_val` varchar(1024) DEFAULT NULL,
+  `trx_id` varchar(1024) DEFAULT NULL,
+  `action` varchar(255) DEFAULT NULL,
+  `sess_id` varchar(512) DEFAULT NULL,
+  `req_id` varchar(30) DEFAULT NULL,
+  `sess_type` varchar(30) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_trx_log_FK_added_by_id` (`added_by_id`),
+  KEY `x_trx_log_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_trx_log_cr_time` (`create_time`),
+  KEY `x_trx_log_up_time` (`update_time`),
+  CONSTRAINT `x_trx_log_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_trx_log_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_trx_log`
+--
+
+LOCK TABLES `x_trx_log` WRITE;
+/*!40000 ALTER TABLE `x_trx_log` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_trx_log` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_user`
+--
+
+DROP TABLE IF EXISTS `x_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_user` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `user_name` varchar(1024) NOT NULL,
+  `descr` varchar(4000) NOT NULL,
+  `status` int(11) NOT NULL DEFAULT '0',
+  `cred_store_id` bigint(20) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `x_user_FK_added_by_id` (`added_by_id`),
+  KEY `x_user_FK_upd_by_id` (`upd_by_id`),
+  KEY `x_user_FK_cred_store_id` (`cred_store_id`),
+  KEY `x_user_cr_time` (`create_time`),
+  KEY `x_user_up_time` (`update_time`),
+  CONSTRAINT `x_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES 
`x_portal_user` (`id`),
+  CONSTRAINT `x_user_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) 
REFERENCES `x_cred_store` (`id`),
+  CONSTRAINT `x_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES 
`x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_user`
+--
+
+LOCK TABLES `x_user` WRITE;
+/*!40000 ALTER TABLE `x_user` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `xa_access_audit`
+--
+
+DROP TABLE IF EXISTS `xa_access_audit`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `xa_access_audit` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `create_time` datetime DEFAULT NULL,
+  `update_time` datetime DEFAULT NULL,
+  `added_by_id` bigint(20) DEFAULT NULL,
+  `upd_by_id` bigint(20) DEFAULT NULL,
+  `audit_type` int(11) NOT NULL DEFAULT '0',
+  `access_result` int(11) DEFAULT '0',
+  `access_type` varchar(255) DEFAULT NULL,
+  `acl_enforcer` varchar(255) DEFAULT NULL,
+  `agent_id` varchar(255) DEFAULT NULL,
+  `client_ip` varchar(255) DEFAULT NULL,
+  `client_type` varchar(255) DEFAULT NULL,
+  `policy_id` bigint(20) DEFAULT '0',
+  `repo_name` varchar(255) DEFAULT NULL,
+  `repo_type` int(11) DEFAULT '0',
+  `result_reason` varchar(255) DEFAULT NULL,
+  `session_id` varchar(255) DEFAULT NULL,
+  `event_time` datetime DEFAULT NULL,
+  `request_user` varchar(255) DEFAULT NULL,
+  `action` varchar(2000) DEFAULT NULL,
+  `request_data` varchar(2000) DEFAULT NULL,
+  `resource_path` varchar(2000) DEFAULT NULL,
+  `resource_type` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `xa_access_audit_added_by_id` (`added_by_id`),
+  KEY `xa_access_audit_upd_by_id` (`upd_by_id`),
+  KEY `xa_access_audit_cr_time` (`create_time`),
+  KEY `xa_access_audit_up_time` (`update_time`),
+  KEY `xa_access_audit_event_time` (`event_time`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `xa_access_audit`
+--
+
+LOCK TABLES `xa_access_audit` WRITE;
+/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Final view structure for view `vx_trx_log`
+--
+
+/*!50001 DROP TABLE IF EXISTS `vx_trx_log`*/;
+/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
+/*!50001 SET @saved_cs_client          = @@character_set_client */;
+/*!50001 SET @saved_cs_results         = @@character_set_results */;
+/*!50001 SET @saved_col_connection     = @@collation_connection */;
+/*!50001 SET character_set_client      = latin1 */;
+/*!50001 SET character_set_results     = latin1 */;
+/*!50001 SET collation_connection      = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50001 VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS 
`id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS 
`update_time`,`x_trx_log`.`added_by_id` AS 
`added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` 
AS `class_type`,`x_trx_log`.`object_id` AS 
`object_id`,`x_trx_log`.`parent_object_id` AS 
`parent_object_id`,`x_trx_log`.`parent_object_class_type` AS 
`parent_object_class_type`,`x_trx_log`.`attr_name` AS 
`attr_name`,`x_trx_log`.`parent_object_name` AS 
`parent_object_name`,`x_trx_log`.`object_name` AS 
`object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS 
`new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS 
`action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS 
`req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by 
`x_trx_log`.`trx_id` */;
+/*!50001 SET character_set_client      = @saved_cs_client */;
+/*!50001 SET character_set_results     = @saved_cs_results */;
+/*!50001 SET collation_connection      = @saved_col_connection */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2014-05-25  0:07:27
\ No newline at end of file

Reply via email to