--
-- Host: localhost    Database: SA8_AP_Current
-- ------------------------------------------------------


--
-- Table structure for table `ac_events`
--

CREATE TABLE `ac_events` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_owner` int NOT NULL,
  `curr_ocurrency` int NOT NULL,
  `last_ocurrency` int NOT NULL,
  `title` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `reason` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ac_events_ref_owner` (`ref_owner`),
  KEY `ac_events_model` (`ref_model`),
  KEY `ac_events_parent` (`ref_parent`),
  KEY `ac_events_team` (`ref_team`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `ac_events`
--


--
-- Table structure for table `ac_history`
--

CREATE TABLE `ac_history` (
  `ref_model` int NOT NULL,
  `ref_source` int NOT NULL,
  `competence` int NOT NULL,
  `family` smallint NOT NULL,
  UNIQUE KEY `family` (`family`,`ref_model`,`ref_source`,`competence`),
  KEY `ac_history_model` (`ref_model`),
  KEY `ac_history_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `ac_history`
--


--
-- Table structure for table `ac_inputs`
--

CREATE TABLE `ac_inputs` (
  `ref_model` int NOT NULL,
  `ref_target` int NOT NULL,
  `ref_source` int NOT NULL,
  `family_target` smallint NOT NULL,
  `family_source` smallint NOT NULL,
  UNIQUE KEY `ref_model` (`ref_model`,`family_target`,`ref_target`,`family_source`,`ref_source`),
  KEY `ac_inputs_model` (`ref_model`),
  KEY `ac_inputs_target` (`ref_target`),
  KEY `ac_inputs_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `ac_inputs`
--


--
-- Table structure for table `ac_ocurrencies`
--

CREATE TABLE `ac_ocurrencies` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_acevent` int NOT NULL,
  `dt_period_start` date NOT NULL,
  `dt_period_end` date NOT NULL,
  `dt_planned_start` date NOT NULL,
  `dt_planned_end` date NOT NULL,
  `dt_ocurred_start` date DEFAULT NULL,
  `dt_ocurred_end` date DEFAULT NULL,
  `feedback` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ac_ocurrencies_model` (`ref_model`),
  KEY `ac_ocurrencies_acevent` (`ref_acevent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `ac_ocurrencies`
--


--
-- Table structure for table `ac_records`
--

CREATE TABLE `ac_records` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_previous` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_indicator` int NOT NULL,
  `ref_actionplan` int NOT NULL,
  `ref_ocurrency` int NOT NULL,
  `ref_owner` int NOT NULL,
  `competence` int NOT NULL,
  `classification` tinyint NOT NULL,
  `family` smallint NOT NULL,
  `origin` smallint NOT NULL,
  `dt_start` date NOT NULL,
  `dt_end` date NOT NULL,
  `dt_finished` date DEFAULT NULL,
  `title` varchar(200) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info_current` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info_tendence` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info_impact` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info_reasons` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ac_records_ref_owner` (`ref_owner`),
  KEY `ac_records_ref_actionplan` (`ref_actionplan`),
  KEY `ac_records_ref_indicator` (`ref_indicator`),
  KEY `ac_records_ref_model` (`ref_model`),
  KEY `ac_records_ref_ocurrency` (`ref_ocurrency`),
  KEY `ac_records_ref_previous` (`ref_previous`),
  KEY `ac_records_ref_source` (`ref_source`),
  KEY `ac_records_classification` (`classification`),
  KEY `ac_records_competence` (`competence`),
  KEY `ac_records_dt_end` (`dt_end`),
  KEY `ac_records_finished` (`dt_finished`),
  KEY `ac_records_dt_start` (`dt_start`),
  KEY `ac_records_family` (`family`),
  KEY `ac_records_origin` (`origin`),
  KEY `ac_records_title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `ac_records`
--


--
-- Table structure for table `am_analytics`
--

CREATE TABLE `am_analytics` (
  `id` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_workspace` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_rule` int DEFAULT NULL,
  `type` int NOT NULL,
  `state` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `source` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `am_analytics_folder` (`ref_folder`),
  KEY `am_analytics_owner` (`ref_owner`),
  KEY `am_analytics_team` (`ref_team`),
  KEY `am_analytics_workspace` (`ref_workspace`),
  KEY `am_analytics_model` (`ref_model`),
  KEY `am_analytics_rule` (`ref_rule`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `am_analytics`
--


--
-- Table structure for table `am_analytics_folders`
--

CREATE TABLE `am_analytics_folders` (
  `id` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_model` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `am_analytics_folders_parent` (`ref_parent`),
  KEY `am_analytics_folders_owner` (`ref_owner`),
  KEY `am_analytics_folders_team` (`ref_team`),
  KEY `am_analytics_folders_model` (`ref_model`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `am_analytics_folders`
--


--
-- Table structure for table `am_models`
--

CREATE TABLE `am_models` (
  `id` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `am_models_owner` (`ref_owner`),
  KEY `am_models_team` (`ref_team`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `am_models`
--


--
-- Table structure for table `aud_activities`
--

CREATE TABLE `aud_activities` (
  `id` int NOT NULL,
  `ref_audit` int NOT NULL,
  `ref_participant_team` int NOT NULL,
  `ref_involved_team` int NOT NULL,
  `ref_owner_audit` int NOT NULL,
  `dt_day` date NOT NULL,
  `tm_start` time NOT NULL,
  `duration` time NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `local` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `participation` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `scope` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_activities`
--


--
-- Table structure for table `aud_activity_rules`
--

CREATE TABLE `aud_activity_rules` (
  `ref_activity` int NOT NULL,
  `ref_requirement` int NOT NULL,
  UNIQUE KEY `ref_activity` (`ref_activity`,`ref_requirement`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_activity_rules`
--


--
-- Table structure for table `aud_actors`
--

CREATE TABLE `aud_actors` (
  `id` int NOT NULL,
  `type` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_actors`
--


--
-- Table structure for table `aud_audits`
--

CREATE TABLE `aud_audits` (
  `id` int NOT NULL,
  `ref_entity` int NOT NULL,
  `ref_program` int NOT NULL,
  `ref_owner_team` int NOT NULL,
  `ref_audit_team` int NOT NULL,
  `type` int NOT NULL,
  `approved` int NOT NULL,
  `released` int NOT NULL,
  `options` int NOT NULL,
  `ref_classifications_scale` int NOT NULL,
  `state` tinyint NOT NULL,
  `template` tinyint NOT NULL,
  `score` double NOT NULL,
  `result` double NOT NULL,
  `dt_start` date DEFAULT NULL,
  `dt_end` date DEFAULT NULL,
  `serial` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `contact` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `objective` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `scope` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `resource` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `conclusion` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `justification` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `observation` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `aud_audits_entity` (`ref_entity`),
  KEY `aud_audits_program` (`ref_program`),
  KEY `aud_audits_owner` (`ref_owner_team`),
  KEY `aud_audits_audit` (`ref_audit_team`),
  KEY `aud_audits_classifications_scale` (`ref_classifications_scale`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_audits`
--


--
-- Table structure for table `aud_checklist_items`
--

CREATE TABLE `aud_checklist_items` (
  `id` int NOT NULL,
  `ref_checklist` int NOT NULL,
  `ref_original` int NOT NULL,
  `ref_owner` int NOT NULL DEFAULT '0',
  `ref_scale` int NOT NULL,
  `ref_parent` int NOT NULL,
  `conformity` int NOT NULL,
  `ref_classifications_scale` int NOT NULL,
  `status` tinyint NOT NULL,
  `score` double NOT NULL,
  `scale_result` double NOT NULL,
  `scale_max` double NOT NULL,
  `score_achived` double NOT NULL,
  `wbs` varchar(30) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `scale_label` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `documents` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `instructions` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `scale_info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `aud_checklist_items_scale` (`ref_scale`),
  KEY `aud_checklist_items_parent` (`ref_parent`),
  KEY `aud_checklist_items_classifications_scale` (`ref_classifications_scale`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_checklist_items`
--


--
-- Table structure for table `aud_checklist_rules`
--

CREATE TABLE `aud_checklist_rules` (
  `ref_checkitem` int NOT NULL,
  `ref_requirement` int NOT NULL,
  UNIQUE KEY `ref_checkitem` (`ref_checkitem`,`ref_requirement`),
  KEY `aud_checklist_rules_checkitem` (`ref_checkitem`),
  KEY `aud_checklist_rules_req` (`ref_requirement`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_checklist_rules`
--


--
-- Table structure for table `aud_classification_scale_item`
--

CREATE TABLE `aud_classification_scale_item` (
  `id` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `score_from` double DEFAULT NULL,
  `score_until` double DEFAULT NULL,
  `result` int DEFAULT NULL,
  `ref_classifications_scale` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `aud_classification_scale_item_classifications_scale` (`ref_classifications_scale`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_classification_scale_item`
--


--
-- Table structure for table `aud_classifications_scale`
--

CREATE TABLE `aud_classifications_scale` (
  `id` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `state` int DEFAULT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  `ref_owner` int NOT NULL,
  `ref_audits` int NOT NULL,
  `ref_checklist_items` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `aud_classifications_scale_owner` (`ref_owner`),
  KEY `aud_classifications_scale_audits` (`ref_audits`),
  KEY `aud_classifications_scale_checklist_items` (`ref_checklist_items`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_classifications_scale`
--


--
-- Table structure for table `aud_constatation`
--

CREATE TABLE `aud_constatation` (
  `id` int NOT NULL,
  `ref_audit` int NOT NULL,
  `ref_author` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_checkitem` int NOT NULL,
  `type` int NOT NULL,
  `score` double NOT NULL,
  `dt_created` date NOT NULL,
  `sector` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `origem` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `evidence` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `recommendations` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  PRIMARY KEY (`id`),
  KEY `aud_const_checkitem` (`ref_checkitem`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_constatation`
--


--
-- Table structure for table `aud_constatation_ocurrences`
--

CREATE TABLE `aud_constatation_ocurrences` (
  `ref_constatation` int NOT NULL,
  `ref_ocurrence` int NOT NULL,
  UNIQUE KEY `ref_constatation` (`ref_constatation`,`ref_ocurrence`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_constatation_ocurrences`
--


--
-- Table structure for table `aud_constatation_rules`
--

CREATE TABLE `aud_constatation_rules` (
  `ref_constatation` int NOT NULL,
  `ref_requirement` int NOT NULL,
  UNIQUE KEY `ref_constatation` (`ref_constatation`,`ref_requirement`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_constatation_rules`
--


--
-- Table structure for table `aud_constatation_types`
--

CREATE TABLE `aud_constatation_types` (
  `id` int NOT NULL,
  `ref_ocurrence_type` int NOT NULL,
  `state` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_constatation_types`
--


--
-- Table structure for table `aud_participant_ability`
--

CREATE TABLE `aud_participant_ability` (
  `id` int NOT NULL,
  `ref_participant` int NOT NULL,
  `ref_rule` int NOT NULL,
  `ref_actor` int NOT NULL,
  `active` int NOT NULL,
  `type` int NOT NULL,
  `dt_end` date NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_participant_ability`
--


--
-- Table structure for table `aud_participant_history`
--

CREATE TABLE `aud_participant_history` (
  `id` int NOT NULL,
  `ref_participant` int NOT NULL,
  `ref_rule` int NOT NULL,
  `ref_actor` int NOT NULL,
  `dt_verified` date NOT NULL,
  `location` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_participant_history`
--


--
-- Table structure for table `aud_programs`
--

CREATE TABLE `aud_programs` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_serial` int NOT NULL,
  `state` tinyint NOT NULL,
  `dt_start` date DEFAULT NULL,
  `dt_end` date DEFAULT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `objective` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `scope` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `resources` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `aud_programs_category` (`ref_category`),
  KEY `aud_programs_owner` (`ref_owner`),
  KEY `aud_programs_team` (`ref_team`),
  KEY `aud_programs_serial` (`ref_serial`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_programs`
--


--
-- Table structure for table `aud_programs_rules`
--

CREATE TABLE `aud_programs_rules` (
  `ref_program` int NOT NULL,
  `ref_rule` int NOT NULL,
  UNIQUE KEY `ref_program` (`ref_program`,`ref_rule`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_programs_rules`
--


--
-- Table structure for table `aud_rules_actors`
--

CREATE TABLE `aud_rules_actors` (
  `ref_rule` int NOT NULL,
  `ref_actor` int NOT NULL,
  UNIQUE KEY `ref_rule` (`ref_rule`,`ref_actor`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_rules_actors`
--


--
-- Table structure for table `aud_rules_participants`
--

CREATE TABLE `aud_rules_participants` (
  `ref_participant` int NOT NULL,
  `ref_rule` int NOT NULL,
  `ref_audit` int NOT NULL,
  `type` int NOT NULL,
  UNIQUE KEY `type` (`type`,`ref_audit`,`ref_rule`,`ref_participant`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `aud_rules_participants`
--


--
-- Table structure for table `bi_artefacts`
--

CREATE TABLE `bi_artefacts` (
  `id` int NOT NULL,
  `ref_server` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `type` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `file` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `cube` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `mdx` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_bi_artefacts_folder` (`ref_folder`),
  KEY `ix_bi_artefacts_owner` (`ref_owner`),
  KEY `ix_bi_artefacts_team` (`ref_team`),
  KEY `ix_bi_artefacts_server` (`ref_server`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_artefacts`
--


--
-- Table structure for table `bi_cube_restrictions`
--

CREATE TABLE `bi_cube_restrictions` (
  `ref_cube` int NOT NULL,
  `restriction` int NOT NULL,
  UNIQUE KEY `ref_cube` (`ref_cube`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_cube_restrictions`
--


--
-- Table structure for table `bi_folder_roots`
--

CREATE TABLE `bi_folder_roots` (
  `ref_project` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_source` int NOT NULL,
  `scope` smallint NOT NULL,
  `type` smallint NOT NULL,
  UNIQUE KEY `ref_project` (`ref_project`,`ref_source`,`scope`,`type`),
  KEY `bi_folder_roots_project_scope` (`ref_project`,`scope`),
  KEY `bi_folder_roots_folder` (`ref_folder`),
  KEY `bi_folder_roots_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_folder_roots`
--


--
-- Table structure for table `bi_folders`
--

CREATE TABLE `bi_folders` (
  `id` int NOT NULL,
  `ref_project` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_team` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bi_folders_project` (`ref_project`),
  KEY `bi_folders_owner` (`ref_owner`),
  KEY `bi_folders_parent` (`ref_parent`),
  KEY `bi_folders_team` (`ref_team`),
  KEY `bi_folders_restriction` (`restriction`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_folders`
--


--
-- Table structure for table `bi_maps`
--

CREATE TABLE `bi_maps` (
  `id` int NOT NULL,
  `ref_server` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `restriction` int NOT NULL,
  `zoom_initial` smallint NOT NULL,
  `type` smallint NOT NULL,
  `position_initial` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `sql` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bi_maps_server` (`ref_server`),
  KEY `bi_maps_folder` (`ref_folder`),
  KEY `bi_maps_owner` (`ref_owner`),
  KEY `bi_maps_team` (`ref_team`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_maps`
--


--
-- Table structure for table `bi_pendencies`
--

CREATE TABLE `bi_pendencies` (
  `id` int NOT NULL,
  `ref_analysis` int NOT NULL,
  `dt_published` date NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bi_pendencies_analysis` (`ref_analysis`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_pendencies`
--


--
-- Table structure for table `bi_projects`
--

CREATE TABLE `bi_projects` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_team` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `bi_projects_user` (`ref_user`),
  KEY `bi_projects_team` (`ref_team`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_projects`
--


--
-- Table structure for table `bi_queries`
--

CREATE TABLE `bi_queries` (
  `id` int NOT NULL,
  `ref_server` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `restriction` int NOT NULL,
  `options` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `cube` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `mdx` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bi_queries_user` (`ref_owner`),
  KEY `bi_queries_restriction` (`restriction`),
  KEY `bi_queries_team` (`ref_team`),
  KEY `bi_queries_folder` (`ref_folder`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_queries`
--


--
-- Table structure for table `bi_query_charts`
--

CREATE TABLE `bi_query_charts` (
  `ref_analysis` int NOT NULL,
  `type` int NOT NULL,
  `options` int NOT NULL,
  `background_color` int NOT NULL,
  `axes_tick_rotate` int NOT NULL,
  `legend_alignment` int NOT NULL,
  `legend_position` int NOT NULL,
  `slicer_alignment` int NOT NULL,
  `slicer_position` int NOT NULL,
  `page_axis` int NOT NULL,
  `chart_axis` int NOT NULL,
  `series_axis` int NOT NULL,
  `plot_axis` int NOT NULL,
  `width` int NOT NULL,
  `height` int NOT NULL,
  `x_axis_angle` int NOT NULL,
  `y_axis_angle` int NOT NULL,
  `slicer_font` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `axes_tick_font` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `legend_font` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `axes_font` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `axes_horizontal_label` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `axes_vertical_label` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `font` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `title` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_analysis` (`ref_analysis`),
  KEY `bi_query_charts_analysis` (`ref_analysis`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_query_charts`
--


--
-- Table structure for table `bi_query_exports`
--

CREATE TABLE `bi_query_exports` (
  `ref_analysis` int NOT NULL,
  `page_size` int NOT NULL,
  `page_orientation` int NOT NULL,
  `chart_split` smallint NOT NULL,
  `page_height` double NOT NULL,
  `page_width` double NOT NULL,
  `table_width` double NOT NULL,
  UNIQUE KEY `ref_analysis` (`ref_analysis`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bi_query_exports`
--


--
-- Table structure for table `bpm_attribute_inst_blob`
--

CREATE TABLE `bpm_attribute_inst_blob` (
  `id` int NOT NULL,
  `content` blob NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_attribute_inst_blob`
--


--
-- Table structure for table `bpm_attribute_inst_clob`
--

CREATE TABLE `bpm_attribute_inst_clob` (
  `id` int NOT NULL,
  `content` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_attribute_inst_clob`
--


--
-- Table structure for table `bpm_attribute_instances`
--

CREATE TABLE `bpm_attribute_instances` (
  `id` int NOT NULL,
  `ref_process_instance` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_task_instance` int NOT NULL,
  `ref_source` int NOT NULL,
  `seq` int NOT NULL,
  `f0` int NOT NULL DEFAULT '0',
  `f1` double NOT NULL DEFAULT '0',
  `content` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_process` (`ref_process`,`ref_process_instance`,`ref_task_instance`,`ref_parent`,`ref_attribute`,`seq`),
  KEY `bpm_attr_instances_proc_inst` (`ref_process_instance`),
  KEY `bpm_attr_instances_attribute` (`ref_attribute`),
  KEY `bpm_interface_inst_parent` (`ref_parent`),
  KEY `bpm_interface_inst_process` (`ref_process`),
  KEY `bpm_interface_inst_task_inst` (`ref_task_instance`),
  KEY `bpm_attribute_instances_f0` (`f0`),
  KEY `bpm_attribute_instances_f1` (`f1`),
  KEY `bpm_att_inst_seq` (`seq`),
  KEY `bpm_attr_inst_content` (`content`),
  KEY `bpm_attribute_instances_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_attribute_instances`
--


--
-- Table structure for table `bpm_attribute_option_items`
--

CREATE TABLE `bpm_attribute_option_items` (
  `id` int NOT NULL,
  `ref_option` int NOT NULL,
  `seq_no` smallint NOT NULL,
  `label` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `content` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_attribute_opt_items_option` (`ref_option`),
  KEY `bpm_attr_opt_content` (`content`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_attribute_option_items`
--


--
-- Table structure for table `bpm_attribute_options`
--

CREATE TABLE `bpm_attribute_options` (
  `id` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_original` int NOT NULL,
  `ref_category` int NOT NULL,
  `family` tinyint NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_attribute_opt_process` (`ref_process`),
  KEY `bpm_attribute_opt_original` (`ref_original`),
  KEY `bpm_attribute_opt_category` (`ref_category`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_attribute_options`
--


--
-- Table structure for table `bpm_business_components`
--

CREATE TABLE `bpm_business_components` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_owner` int NOT NULL,
  `fl_active` tinyint NOT NULL,
  `dt_modified` datetime NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_business_components_cat` (`ref_category`),
  KEY `bpm_business_components_team` (`ref_team`),
  KEY `bpm_business_components_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_business_components`
--


--
-- Table structure for table `bpm_condition_items`
--

CREATE TABLE `bpm_condition_items` (
  `ref_source` int NOT NULL,
  `ref_value_source` int NOT NULL,
  `seq_item` int NOT NULL,
  `value_family` int NOT NULL,
  `family` int NOT NULL,
  `fl_open_parentheses` tinyint NOT NULL,
  `fl_close_parentheses` tinyint NOT NULL,
  `logical_operator_type` tinyint NOT NULL,
  `parameter` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `conditional_operator` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `logical_operator` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_source` (`ref_source`,`family`,`seq_item`),
  KEY `bpm_cond_it_source` (`ref_value_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_condition_items`
--


--
-- Table structure for table `bpm_data_exports`
--

CREATE TABLE `bpm_data_exports` (
  `ref_task` int NOT NULL,
  `file_name` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `file_type` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `directory` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_data_exports`
--


--
-- Table structure for table `bpm_email_attachment_mappings`
--

CREATE TABLE `bpm_email_attachment_mappings` (
  `ref_task` int NOT NULL,
  `ref_attribute` int NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_attribute`),
  KEY `bpm_email_attachment_task` (`ref_task`),
  KEY `bpm_email_attachment_attr` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_email_attachment_mappings`
--


--
-- Table structure for table `bpm_email_instances`
--

CREATE TABLE `bpm_email_instances` (
  `id` int NOT NULL,
  `ref_task_intance` int NOT NULL,
  `type` tinyint NOT NULL,
  `dt_sent` datetime DEFAULT NULL,
  `subject` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `mail_to` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `message` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_email_instances_task_ins` (`ref_task_intance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_email_instances`
--


--
-- Table structure for table `bpm_favourite_processes`
--

CREATE TABLE `bpm_favourite_processes` (
  `id` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_user` int NOT NULL,
  `seqno` smallint NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_process` (`ref_process`,`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_favourite_processes`
--


--
-- Table structure for table `bpm_interface_column_mappings`
--

CREATE TABLE `bpm_interface_column_mappings` (
  `ref_interface_control` int NOT NULL,
  `ref_source_interface_control` int NOT NULL,
  `ref_interface_control_return` int NOT NULL,
  `ref_interface_level` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `type` tinyint NOT NULL,
  UNIQUE KEY `ref_interface_control` (`ref_interface_control`,`ref_interface_level`,`ref_source_interface_control`,`type`,`ref_interface_control_return`,`ref_attribute`),
  KEY `bpm_int_col_map_att` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_interface_column_mappings`
--


--
-- Table structure for table `bpm_interface_control_mappings`
--

CREATE TABLE `bpm_interface_control_mappings` (
  `ref_interface_control` int NOT NULL,
  `ref_interface_level` int NOT NULL,
  `ref_attribute` int NOT NULL,
  UNIQUE KEY `ref_interface_control` (`ref_interface_control`,`ref_attribute`),
  KEY `bpm_int_ctl_map_level` (`ref_interface_level`),
  KEY `bpm_int_control_map_attribute` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_interface_control_mappings`
--


--
-- Table structure for table `bpm_interface_filter_mappings`
--

CREATE TABLE `bpm_interface_filter_mappings` (
  `ref_interface_control` int NOT NULL,
  `ref_source_interface_control` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `ref_interface_level` int NOT NULL,
  `ref_attribute_mapping` int NOT NULL,
  `seq_item` int NOT NULL,
  `fl_open_parentheses` tinyint NOT NULL,
  `fl_close_parentheses` tinyint NOT NULL,
  `logical_operator_type` tinyint NOT NULL,
  `conditional_operator` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `logical_operator` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `column_value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_interface_control` (`ref_interface_control`,`ref_interface_level`,`seq_item`,`ref_attribute_mapping`),
  KEY `bpm_int_filter_map_source` (`ref_source_interface_control`),
  KEY `bpm_int_filter_map_att` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_interface_filter_mappings`
--


--
-- Table structure for table `bpm_interface_level_mappings`
--

CREATE TABLE `bpm_interface_level_mappings` (
  `ref_source` int NOT NULL,
  `ref_target` int NOT NULL,
  UNIQUE KEY `ref_source` (`ref_source`,`ref_target`),
  KEY `bpm_int_lvl_map_source` (`ref_source`),
  KEY `bpm_int_lvl_map_target` (`ref_target`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_interface_level_mappings`
--


--
-- Table structure for table `bpm_interfaces`
--

CREATE TABLE `bpm_interfaces` (
  `id` int NOT NULL,
  `ref_task` int NOT NULL,
  `ref_component` int NOT NULL,
  `ref_data_source` int NOT NULL,
  `ref_handler` int NOT NULL,
  `type` tinyint NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_interfaces_task` (`ref_task`),
  KEY `bpm_interfaces_component` (`ref_component`),
  KEY `bpm_interfaces_dt_source` (`ref_data_source`),
  KEY `bpm_interfaces_handler` (`ref_handler`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_interfaces`
--


--
-- Table structure for table `bpm_metric_historicals`
--

CREATE TABLE `bpm_metric_historicals` (
  `id` int NOT NULL,
  `ref_metric` int NOT NULL,
  `ref_process_instance` int NOT NULL,
  `ref_task_instance` int NOT NULL,
  `type` tinyint NOT NULL,
  `min_value` double NOT NULL,
  `max_value` double NOT NULL,
  `realized` double NOT NULL,
  `dt_collect` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_metric_histo_metric` (`ref_metric`),
  KEY `bpm_metric_histo_proc_inst` (`ref_process_instance`),
  KEY `bpm_metric_histo_task_inst` (`ref_task_instance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_metric_historicals`
--


--
-- Table structure for table `bpm_metric_queries`
--

CREATE TABLE `bpm_metric_queries` (
  `ref_metric` int NOT NULL,
  `ref_process_instance` int NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `dt_start` datetime DEFAULT NULL,
  `dt_end` datetime DEFAULT NULL,
  KEY `bpm_metric_queries_metric` (`ref_metric`),
  KEY `bpm_metric_queries_instance` (`ref_process_instance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_metric_queries`
--


--
-- Table structure for table `bpm_metrics`
--

CREATE TABLE `bpm_metrics` (
  `id` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_data_source` int NOT NULL,
  `ref_bam_role` int NOT NULL,
  `type` tinyint NOT NULL,
  `fl_enable` tinyint NOT NULL,
  `min_value` double NOT NULL,
  `max_value` double NOT NULL,
  `dt_start` datetime NOT NULL,
  `dt_end` datetime NOT NULL,
  `dt_modified` datetime NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `command` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_metrics_processes` (`ref_process`),
  KEY `bpm_metrics_bam_role` (`ref_bam_role`),
  KEY `bpm_metrics_data_source` (`ref_data_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_metrics`
--


--
-- Table structure for table `bpm_procedure_executions`
--

CREATE TABLE `bpm_procedure_executions` (
  `ref_task` int NOT NULL,
  `conclusion_time` float NOT NULL,
  `source` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_procedure_executions`
--


--
-- Table structure for table `bpm_process_instances`
--

CREATE TABLE `bpm_process_instances` (
  `id` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_unit` int NOT NULL,
  `stage` tinyint NOT NULL,
  `state` tinyint NOT NULL,
  `priority` tinyint NOT NULL,
  `estimated_cost` double NOT NULL,
  `real_cost` double NOT NULL,
  `dt_start` datetime NOT NULL,
  `dt_end` datetime DEFAULT NULL,
  `serial` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(320) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_process_instances_parent` (`ref_parent`),
  KEY `bpm_process_instances_user` (`ref_user`),
  KEY `bpm_process_instances_process` (`ref_process`),
  KEY `bpm_process_instances_unit` (`ref_unit`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_process_instances`
--


--
-- Table structure for table `bpm_role_attribute_mappings`
--

CREATE TABLE `bpm_role_attribute_mappings` (
  `ref_role` int NOT NULL,
  `ref_attribute` int NOT NULL,
  UNIQUE KEY `ref_role` (`ref_role`,`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_role_attribute_mappings`
--


--
-- Table structure for table `bpm_role_user_mappings`
--

CREATE TABLE `bpm_role_user_mappings` (
  `ref_role` int NOT NULL,
  `ref_user` int NOT NULL,
  UNIQUE KEY `ref_role` (`ref_role`,`ref_user`),
  KEY `bpm_role_user_mappings_role` (`ref_role`),
  KEY `bpm_role_user_mappings_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_role_user_mappings`
--


--
-- Table structure for table `bpm_roles`
--

CREATE TABLE `bpm_roles` (
  `id` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_original` int NOT NULL,
  `seqno` smallint NOT NULL,
  `fl_active` tinyint NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_roles_parent` (`ref_parent`),
  KEY `bpm_roles_process` (`ref_process`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_roles`
--


--
-- Table structure for table `bpm_rule_arguments`
--

CREATE TABLE `bpm_rule_arguments` (
  `id` int NOT NULL,
  `seq` int NOT NULL,
  `family` int NOT NULL,
  `ref_instruction` int NOT NULL,
  `content` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `ref_parent` int NOT NULL,
  `type` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_rule_arguments_family` (`family`),
  KEY `bpm_rule_arguments_ref_parent` (`ref_parent`),
  KEY `bpm_rule_arguments_seq` (`seq`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_rule_arguments`
--


--
-- Table structure for table `bpm_rule_condition_items`
--

CREATE TABLE `bpm_rule_condition_items` (
  `ref_instruction` int NOT NULL,
  `seq` int NOT NULL,
  `ref_left_argument` int NOT NULL,
  `comparison_operator` int NOT NULL,
  `logical_operator` int NOT NULL,
  `fl_open_parentheses` tinyint NOT NULL,
  `fl_close_parentheses` tinyint NOT NULL,
  `ref_right_argument` int DEFAULT NULL,
  UNIQUE KEY `ref_instruction` (`ref_instruction`,`seq`),
  KEY `bpm_rule_condition_items_ref_instruction` (`ref_instruction`),
  KEY `bpm_rule_condition_items_seq` (`seq`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_rule_condition_items`
--


--
-- Table structure for table `bpm_rule_instructions`
--

CREATE TABLE `bpm_rule_instructions` (
  `id` int NOT NULL,
  `ref_parent` int NOT NULL,
  `parent_family` int NOT NULL,
  `event_code` int NOT NULL,
  `function_code` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `family` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_rule_instructions_parent_family` (`parent_family`),
  KEY `bpm_rule_instructions_ref_parent` (`ref_parent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_rule_instructions`
--


--
-- Table structure for table `bpm_scenario_binding_results`
--

CREATE TABLE `bpm_scenario_binding_results` (
  `ref_binding` int NOT NULL,
  `instances` int NOT NULL,
  KEY `bpm_scenario_bind_res_binding` (`ref_binding`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_binding_results`
--


--
-- Table structure for table `bpm_scenario_bindings`
--

CREATE TABLE `bpm_scenario_bindings` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_target` int NOT NULL,
  `ref_scenario` int NOT NULL,
  `fl_exception` tinyint NOT NULL,
  `probability` double NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_scenario_bindings_source` (`ref_source`),
  KEY `bpm_scenario_bindings_targe` (`ref_target`),
  KEY `bpm_scenario_bindings_scenario` (`ref_scenario`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_bindings`
--


--
-- Table structure for table `bpm_scenario_resource_results`
--

CREATE TABLE `bpm_scenario_resource_results` (
  `ref_scenario` int NOT NULL,
  `ref_resource` int NOT NULL,
  `usage` double NOT NULL,
  UNIQUE KEY `ref_scenario` (`ref_scenario`,`ref_resource`),
  KEY `bpm_scenario_res_results_scen` (`ref_scenario`),
  KEY `bpm_scenario_res_results_res` (`ref_resource`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_resource_results`
--


--
-- Table structure for table `bpm_scenario_results`
--

CREATE TABLE `bpm_scenario_results` (
  `ref_scenario` int NOT NULL,
  `ref_owner` int NOT NULL,
  `assumed` int NOT NULL,
  `completed` int NOT NULL,
  `waiting` int NOT NULL,
  `wait_min_time` double NOT NULL,
  `wait_avg_time` double NOT NULL,
  `wait_max_time` double NOT NULL,
  `min_time` double NOT NULL,
  `max_time` double NOT NULL,
  `avg_time` double NOT NULL,
  `min_cost` double NOT NULL,
  `max_cost` double NOT NULL,
  `avg_cost` double NOT NULL,
  `total_time` double NOT NULL,
  `total_wait_time` double NOT NULL,
  `total_cost` double NOT NULL,
  `dt_start` datetime NOT NULL,
  `dt_end` datetime NOT NULL,
  KEY `bpm_scenario_results_scenario` (`ref_scenario`),
  KEY `bpm_scenario_results_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_results`
--


--
-- Table structure for table `bpm_scenario_task_resources`
--

CREATE TABLE `bpm_scenario_task_resources` (
  `ref_scenario_task` int NOT NULL,
  `ref_resource` int NOT NULL,
  `quantity` int NOT NULL,
  UNIQUE KEY `ref_simulation_task` (`ref_scenario_task`,`ref_resource`),
  KEY `bpm_scen_task_res_scen_task` (`ref_scenario_task`),
  KEY `bpm_scen_task_res_resource` (`ref_resource`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_task_resources`
--


--
-- Table structure for table `bpm_scenario_task_results`
--

CREATE TABLE `bpm_scenario_task_results` (
  `ref_scenario_task` int NOT NULL,
  `assumed` int NOT NULL,
  `waiting` int NOT NULL,
  `completed` int NOT NULL,
  `wait_min_time` double NOT NULL,
  `wait_max_time` double NOT NULL,
  `wait_avg_time` double NOT NULL,
  `min_time` double NOT NULL,
  `max_time` double NOT NULL,
  `avg_time` double NOT NULL,
  `min_cost` double NOT NULL,
  `max_cost` double NOT NULL,
  `avg_cost` double NOT NULL,
  `total_time` double NOT NULL,
  `total_wait_time` double NOT NULL,
  `total_cost` double NOT NULL,
  KEY `bpm_scen_task_result_scen_task` (`ref_scenario_task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_task_results`
--


--
-- Table structure for table `bpm_scenario_tasks`
--

CREATE TABLE `bpm_scenario_tasks` (
  `id` int NOT NULL,
  `ref_scenario` int NOT NULL,
  `ref_task` int NOT NULL,
  `ref_sub_scenario` int NOT NULL,
  `time_unit` tinyint NOT NULL,
  `event_time_unit` tinyint NOT NULL,
  `conclusion_time` double NOT NULL,
  `event_time` double NOT NULL,
  `fixed_cost` double NOT NULL,
  `event_probability` double NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_scenario_tasks_cenario` (`ref_scenario`),
  KEY `bpm_scenario_tasks_task` (`ref_task`),
  KEY `bpm_scenario_tasks_sub_scen` (`ref_sub_scenario`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenario_tasks`
--


--
-- Table structure for table `bpm_scenarios`
--

CREATE TABLE `bpm_scenarios` (
  `id` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_simulation` int NOT NULL,
  `ref_owner` int NOT NULL,
  `execution_limit` int NOT NULL,
  `time_unit` tinyint NOT NULL,
  `fl_calendar` tinyint NOT NULL,
  `execution_interval` double NOT NULL,
  `dt_start` datetime DEFAULT NULL,
  `dt_end` datetime DEFAULT NULL,
  `currency` varchar(30) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_scenarios_team` (`ref_team`),
  KEY `bpm_scenarios_simulation` (`ref_simulation`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_scenarios`
--


--
-- Table structure for table `bpm_script_tasks`
--

CREATE TABLE `bpm_script_tasks` (
  `ref_task` int NOT NULL,
  `ref_source` int NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_script_tasks`
--


--
-- Table structure for table `bpm_send_email_tasks`
--

CREATE TABLE `bpm_send_email_tasks` (
  `ref_task` int NOT NULL,
  `ref_role` int NOT NULL,
  `fixed_address` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `fixed_cc` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `fixed_cco` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `subject` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `body` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `fl_claimer_destinatary` tinyint NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`),
  KEY `bpm_send_email_tasks_role` (`ref_role`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_send_email_tasks`
--


--
-- Table structure for table `bpm_simulation_resources`
--

CREATE TABLE `bpm_simulation_resources` (
  `id` int NOT NULL,
  `ref_simulation` int NOT NULL,
  `ref_calendar` int NOT NULL,
  `quantity` int NOT NULL,
  `hour_cost` double NOT NULL,
  `fixed_cost` double NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_simulation_resour_simul` (`ref_simulation`),
  KEY `bpm_simulation_resour_calen` (`ref_calendar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_simulation_resources`
--


--
-- Table structure for table `bpm_simulations`
--

CREATE TABLE `bpm_simulations` (
  `id` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_process` int NOT NULL,
  `ref_category` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `dt_created` datetime NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_simulations_owner` (`ref_owner`),
  KEY `bpm_simulations_team` (`ref_team`),
  KEY `bpm_simulations_process` (`ref_process`),
  KEY `bpm_simulations_category` (`ref_category`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_simulations`
--


--
-- Table structure for table `bpm_solve_instances`
--

CREATE TABLE `bpm_solve_instances` (
  `id` int NOT NULL,
  `ref_process_instance` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_from_task_instance` int NOT NULL,
  `ref_to_task` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_solve_instances_proc_inst` (`ref_process_instance`),
  KEY `bpm_solve_instances_user` (`ref_user`),
  KEY `bpm_solve_instances_from_inst` (`ref_from_task_instance`),
  KEY `bpm_solve_instances_to_task` (`ref_to_task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_solve_instances`
--


--
-- Table structure for table `bpm_standby_instances`
--

CREATE TABLE `bpm_standby_instances` (
  `ref_process_instance` int NOT NULL,
  `ref_user` int NOT NULL,
  `dt_created` datetime NOT NULL,
  `dt_standby` datetime DEFAULT NULL,
  KEY `bpm_standby_instances_process_instance` (`ref_process_instance`),
  KEY `bpm_standby_instances_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_standby_instances`
--


--
-- Table structure for table `bpm_subprocess_attr_mappings`
--

CREATE TABLE `bpm_subprocess_attr_mappings` (
  `ref_source_attribute` int NOT NULL,
  `ref_target_attribute` int NOT NULL,
  `ref_task` int NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_source_attribute`,`ref_target_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_subprocess_attr_mappings`
--


--
-- Table structure for table `bpm_subprocess_tasks`
--

CREATE TABLE `bpm_subprocess_tasks` (
  `ref_task` int NOT NULL,
  `ref_process` int NOT NULL,
  `fl_synchronous` tinyint NOT NULL,
  `instance_name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_process`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_subprocess_tasks`
--


--
-- Table structure for table `bpm_task_attributes`
--

CREATE TABLE `bpm_task_attributes` (
  `ref_task` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `position` int NOT NULL,
  `fl_modifiable` tinyint NOT NULL,
  `fl_required` tinyint NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_task_attributes`
--


--
-- Table structure for table `bpm_task_bindings`
--

CREATE TABLE `bpm_task_bindings` (
  `id` int NOT NULL,
  `ref_from_task` int NOT NULL,
  `ref_to_task` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `label_width` int NOT NULL,
  `label_height` int NOT NULL,
  `from_x` int NOT NULL,
  `from_y` int NOT NULL,
  `to_x` int NOT NULL,
  `to_y` int NOT NULL,
  `from_handle` tinyint NOT NULL,
  `to_handle` tinyint NOT NULL,
  `fl_deleted` tinyint NOT NULL,
  `message_type` tinyint NOT NULL,
  `target_solve_type` smallint NOT NULL,
  `text_color` varchar(7) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `anchor` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `parameter` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `label` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `font_style` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `line_segments` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_from_task` (`ref_from_task`,`ref_to_task`),
  KEY `bpm_task_bindings_attribute` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_task_bindings`
--


--
-- Table structure for table `bpm_task_fields`
--

CREATE TABLE `bpm_task_fields` (
  `ref_task` int NOT NULL,
  `seq` int NOT NULL,
  `field` tinyint NOT NULL,
  `family` smallint NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `content` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`family`,`field`,`seq`),
  KEY `bpm_task_fields_task` (`ref_task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_task_fields`
--


--
-- Table structure for table `bpm_task_instance_errors`
--

CREATE TABLE `bpm_task_instance_errors` (
  `id` int NOT NULL,
  `ref_process_instance` int NOT NULL,
  `ref_task_instance` int NOT NULL,
  `executation_state` tinyint NOT NULL,
  `dt_created` datetime NOT NULL,
  `message` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_task_inst_errors_proc_inst` (`ref_process_instance`),
  KEY `bpm_task_inst_errors_task_inst` (`ref_task_instance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_task_instance_errors`
--


--
-- Table structure for table `bpm_task_metric_mappings`
--

CREATE TABLE `bpm_task_metric_mappings` (
  `ref_metric` int NOT NULL,
  `ref_task` int NOT NULL,
  UNIQUE KEY `ref_metric` (`ref_metric`,`ref_task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_task_metric_mappings`
--


--
-- Table structure for table `bpm_task_notifications`
--

CREATE TABLE `bpm_task_notifications` (
  `ref_task` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `seqno` smallint NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_attribute`),
  KEY `bpm_task_notifications_task` (`ref_task`),
  KEY `bpm_task_notifications_attrib` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_task_notifications`
--


--
-- Table structure for table `bpm_trans_filter_mappings`
--

CREATE TABLE `bpm_trans_filter_mappings` (
  `ref_task` int NOT NULL,
  `ref_source_interface_control` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `seq_item` int NOT NULL,
  `fl_open_parentheses` tinyint NOT NULL,
  `fl_close_parentheses` tinyint NOT NULL,
  `logical_operator_type` tinyint NOT NULL,
  `conditional_operator` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `logical_operator` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `column_value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`seq_item`),
  KEY `bpm_trans_filter_map_att` (`ref_attribute`),
  KEY `bpm_trans_filter_map_source` (`ref_source_interface_control`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_trans_filter_mappings`
--


--
-- Table structure for table `bpm_transaction_mappings`
--

CREATE TABLE `bpm_transaction_mappings` (
  `ref_task` int NOT NULL,
  `ref_interface_level` int NOT NULL,
  `ref_interface_control` int NOT NULL,
  `ref_attribute` int NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`,`ref_interface_level`,`ref_interface_control`,`ref_attribute`),
  KEY `bpm_trans_map_task` (`ref_task`),
  KEY `bpm_trans_map_level` (`ref_interface_level`),
  KEY `bpm_trans_map_control` (`ref_interface_control`),
  KEY `bpm_trans_map_attribute` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_transaction_mappings`
--


--
-- Table structure for table `bpm_transaction_tasks`
--

CREATE TABLE `bpm_transaction_tasks` (
  `ref_task` int NOT NULL,
  `ref_component` int NOT NULL,
  `operation` tinyint NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`),
  KEY `bpm_trans_tasks_task` (`ref_task`),
  KEY `bpm_trans_tasks_component` (`ref_component`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_transaction_tasks`
--


--
-- Table structure for table `bpm_tree_items`
--

CREATE TABLE `bpm_tree_items` (
  `id` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_source` int NOT NULL,
  `family` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_tree_items_parent` (`ref_parent`),
  KEY `bpm_tree_items_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_tree_items`
--


--
-- Table structure for table `bpm_user_delegations`
--

CREATE TABLE `bpm_user_delegations` (
  `id` int NOT NULL,
  `ref_author` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_target` int NOT NULL,
  `ref_role` int NOT NULL,
  `dt_created` date NOT NULL,
  `dt_start` date NOT NULL,
  `dt_end` date NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bpm_user_delegations_author` (`ref_author`),
  KEY `bpm_user_delegations_source` (`ref_source`),
  KEY `bpm_user_delegations_dest` (`ref_target`),
  KEY `bpm_user_delegations_role` (`ref_role`),
  KEY `bpm_user_delegations_created` (`dt_created`),
  KEY `bpm_user_delegations_start` (`dt_start`),
  KEY `bpm_user_delegations_end` (`dt_end`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_user_delegations`
--


--
-- Table structure for table `bpm_ws_tasks`
--

CREATE TABLE `bpm_ws_tasks` (
  `ref_task` int NOT NULL,
  `ref_attribute` int NOT NULL,
  `url` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `response_tag` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `request` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_task` (`ref_task`),
  KEY `bpm_ws_tasks_task` (`ref_task`),
  KEY `bpm_ws_tasks_attribute` (`ref_attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bpm_ws_tasks`
--


--
-- Table structure for table `brm_arguments`
--

CREATE TABLE `brm_arguments` (
  `id` int NOT NULL,
  `ref_method` int NOT NULL,
  `family` tinyint NOT NULL,
  `label` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `default_value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_method` (`ref_method`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_arguments`
--


--
-- Table structure for table `brm_consumers`
--

CREATE TABLE `brm_consumers` (
  `id` int NOT NULL,
  `ref_method` int NOT NULL,
  `ref_context` int NOT NULL,
  `ref_owner` int NOT NULL,
  `operation` tinyint NOT NULL,
  `family` smallint NOT NULL,
  `ts_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `url` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `brm_consumers_method` (`ref_method`),
  KEY `brm_consumers_context` (`ref_context`),
  KEY `brm_consumers_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_consumers`
--


--
-- Table structure for table `brm_errors`
--

CREATE TABLE `brm_errors` (
  `id` int NOT NULL,
  `status` int NOT NULL,
  `message` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_errors`
--


--
-- Table structure for table `brm_executions`
--

CREATE TABLE `brm_executions` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_method` int NOT NULL,
  `ref_error` int NOT NULL,
  `result` int NOT NULL,
  `ts_enter` timestamp NULL DEFAULT NULL,
  `ts_exit` timestamp NULL DEFAULT NULL,
  `duration` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `brm_executions_method` (`ref_method`),
  KEY `brm_executions_user` (`ref_user`),
  KEY `brm_executions_error` (`ref_error`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_executions`
--


--
-- Table structure for table `brm_methods`
--

CREATE TABLE `brm_methods` (
  `id` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_script` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_team` int NOT NULL,
  `flavour` tinyint NOT NULL,
  `fl_notification` tinyint NOT NULL,
  `name` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `uuid` varchar(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `stage` tinyint NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `brm_methods_owner` (`ref_owner`),
  KEY `brm_methods_script` (`ref_script`),
  KEY `brm_methods_team` (`ref_team`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_methods`
--


--
-- Table structure for table `brm_parameter_mappings`
--

CREATE TABLE `brm_parameter_mappings` (
  `ref_consumer` int NOT NULL,
  `ref_argument` int NOT NULL,
  `value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_consumer` (`ref_consumer`,`ref_argument`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_parameter_mappings`
--


--
-- Table structure for table `brm_remote_calls`
--

CREATE TABLE `brm_remote_calls` (
  `id` int NOT NULL,
  `ref_rule` int NOT NULL,
  `ref_access` int NOT NULL,
  `duration` int NOT NULL,
  `state` tinyint NOT NULL,
  `dt_call` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `dt_finish` timestamp NULL DEFAULT NULL,
  `origin` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `brm_remote_calls_rule` (`ref_rule`),
  KEY `brm_remote_calls_access` (`ref_access`),
  KEY `brm_remote_calls_origin` (`origin`),
  KEY `brm_remote_calls_state` (`state`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `brm_remote_calls`
--


--
-- Table structure for table `bsc_classifications`
--

CREATE TABLE `bsc_classifications` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_source` int NOT NULL,
  `family` smallint NOT NULL,
  `type` smallint NOT NULL,
  `number` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bsc_classifications_number` (`number`),
  KEY `bsc_classifications_model` (`ref_model`),
  KEY `bsc_classifications_parent` (`ref_parent`),
  KEY `bsc_classifications_source` (`type`,`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_classifications`
--


--
-- Table structure for table `bsc_clones`
--

CREATE TABLE `bsc_clones` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_perspective` int NOT NULL,
  `ref_objective` int NOT NULL,
  `ref_strategy` int NOT NULL,
  `ref_indicator` int NOT NULL,
  `type` smallint NOT NULL,
  `seq_no` smallint NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bsc_clones_source` (`ref_source`),
  KEY `bsc_clones_strategy` (`ref_strategy`),
  KEY `bsc_clones_perspective` (`ref_perspective`),
  KEY `bsc_clones_objective` (`ref_objective`),
  KEY `bsc_clones_indicator` (`ref_indicator`),
  KEY `bsc_clones_model` (`ref_model`),
  KEY `bsc_clones_type` (`type`),
  KEY `bsc_clones_seq_no` (`seq_no`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_clones`
--


--
-- Table structure for table `bsc_dependencies`
--

CREATE TABLE `bsc_dependencies` (
  `ref_model` int NOT NULL,
  `ref_target` int NOT NULL,
  `ref_source` int NOT NULL,
  `family` smallint NOT NULL,
  UNIQUE KEY `ref_model` (`ref_model`,`ref_target`,`ref_source`,`family`),
  KEY `bsc_dependencies_target` (`family`,`ref_target`),
  KEY `bsc_dependencies_model` (`ref_model`),
  KEY `bsc_dependencies_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_dependencies`
--


--
-- Table structure for table `bsc_initiatives`
--

CREATE TABLE `bsc_initiatives` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_actionplan` int NOT NULL,
  `ref_previous` int NOT NULL,
  `ref_delegate` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_verificator` int NOT NULL,
  `progress` tinyint NOT NULL,
  `effective` tinyint NOT NULL,
  `seq_no` smallint NOT NULL,
  `state` smallint NOT NULL,
  `estim_investment` double NOT NULL,
  `real_investment` double NOT NULL,
  `estim_start_date` date DEFAULT NULL,
  `estim_end_date` date DEFAULT NULL,
  `real_start_date` date DEFAULT NULL,
  `real_end_date` date DEFAULT NULL,
  `state_date` date DEFAULT NULL,
  `real_verify_date` date DEFAULT NULL,
  `location` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `title` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `scope` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `reason` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `method` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `verify_info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `instructions` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `feedback` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bsc_initiatives_model` (`ref_model`),
  KEY `bsc_initiatives_actionplan` (`ref_actionplan`),
  KEY `bsc_initiatives_ref_owner` (`ref_owner`),
  KEY `bsc_initiatives_ref_verificator` (`ref_verificator`),
  KEY `bsc_initiatives_ref_previous` (`ref_previous`),
  KEY `bsc_initiatives_ref_delegate` (`ref_delegate`),
  KEY `bsc_initiatives_ref_team` (`ref_team`),
  KEY `bsc_initiatives_estim_start` (`estim_start_date`),
  KEY `bsc_initiatives_estim_end` (`estim_end_date`),
  KEY `bsc_initiatives_real_start` (`real_start_date`),
  KEY `bsc_initiatives_real_end` (`real_end_date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_initiatives`
--


--
-- Table structure for table `bsc_items`
--

CREATE TABLE `bsc_items` (
  `ref_indicator` int NOT NULL,
  `competence` int NOT NULL,
  `family` smallint NOT NULL,
  `ref_indicator_kind` tinyint NOT NULL,
  `meta` double NOT NULL,
  `result` double NOT NULL,
  `benchmark` double NOT NULL,
  `dt_meta` date NOT NULL,
  `dt_result` date DEFAULT NULL,
  `dt_benchmark` date DEFAULT NULL,
  UNIQUE KEY `family` (`family`,`ref_indicator`,`dt_meta`),
  UNIQUE KEY `family_2` (`family`,`ref_indicator`,`competence`),
  KEY `bsc_items_indicator` (`ref_indicator`),
  KEY `bsc_items_competence` (`competence`),
  KEY `bsc_items_result` (`result`),
  KEY `bsc_items_indicator_kind` (`ref_indicator_kind`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_items`
--


--
-- Table structure for table `bsc_queries`
--

CREATE TABLE `bsc_queries` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_indicator` int NOT NULL,
  `ref_folder` int NOT NULL,
  `type` smallint NOT NULL,
  `mode` smallint NOT NULL,
  `dt_competence` date DEFAULT NULL,
  `dt_execution` datetime DEFAULT NULL,
  `dsn` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `sql` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bsc_queries_folder` (`ref_folder`),
  KEY `bsc_queries_ref_model` (`ref_model`),
  KEY `bsc_queries_ref_indicator` (`ref_indicator`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_queries`
--


--
-- Table structure for table `bsc_relations`
--

CREATE TABLE `bsc_relations` (
  `ref_model` int NOT NULL,
  `ref_theme` int NOT NULL,
  `ref_this` int NOT NULL,
  `ref_other` int NOT NULL,
  `strength` double NOT NULL,
  `family` smallint NOT NULL,
  UNIQUE KEY `ref_model` (`ref_model`,`ref_theme`,`family`,`ref_this`,`ref_other`),
  KEY `bsc_relations_theme` (`ref_theme`),
  KEY `bsc_relations_this` (`ref_this`),
  KEY `bsc_relations_other` (`ref_other`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_relations`
--


--
-- Table structure for table `bsc_scenarios`
--

CREATE TABLE `bsc_scenarios` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bsc_scenarios_ref_model` (`ref_model`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_scenarios`
--


--
-- Table structure for table `bsc_themes`
--

CREATE TABLE `bsc_themes` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `state` tinyint NOT NULL,
  `color` varchar(7) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_model` (`ref_model`,`name`),
  KEY `bsc_themes_ref_model` (`ref_model`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_themes`
--


--
-- Table structure for table `bsc_vault`
--

CREATE TABLE `bsc_vault` (
  `id` int NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `seal` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bsc_vault`
--


--
-- Table structure for table `bud_child_revisions`
--

CREATE TABLE `bud_child_revisions` (
  `ref_item` int NOT NULL,
  `ref_serie` int NOT NULL,
  UNIQUE KEY `ref_item` (`ref_item`,`ref_serie`),
  KEY `bud_child_revisions_item` (`ref_item`),
  KEY `bud_child_revisions_serie` (`ref_serie`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_child_revisions`
--


--
-- Table structure for table `bud_package_instances`
--

CREATE TABLE `bud_package_instances` (
  `id` int DEFAULT NULL,
  `ref_instance` int DEFAULT NULL,
  `ref_package_item` int DEFAULT NULL,
  `ref_owner` int DEFAULT NULL,
  `state` tinyint DEFAULT NULL,
  UNIQUE KEY `ref_instance` (`ref_instance`,`ref_package_item`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_package_instances`
--


--
-- Table structure for table `bud_package_items`
--

CREATE TABLE `bud_package_items` (
  `id` int NOT NULL,
  `ref_package` int DEFAULT NULL,
  `ref_item` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_package` (`ref_package`,`ref_item`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_package_items`
--


--
-- Table structure for table `bud_package_totals`
--

CREATE TABLE `bud_package_totals` (
  `ref_package` int DEFAULT NULL,
  `ref_instance` int DEFAULT NULL,
  `value` decimal(10,0) DEFAULT NULL,
  `state` tinyint DEFAULT NULL,
  UNIQUE KEY `ref_package` (`ref_package`,`ref_instance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_package_totals`
--


--
-- Table structure for table `bud_packages`
--

CREATE TABLE `bud_packages` (
  `id` int NOT NULL,
  `ref_plan` int DEFAULT NULL,
  `ref_owner` int DEFAULT NULL,
  `ref_serie` int DEFAULT NULL,
  `restriction` int NOT NULL,
  `state` tinyint DEFAULT NULL,
  `total` decimal(10,0) DEFAULT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_packages`
--


--
-- Table structure for table `bud_plan_data`
--

CREATE TABLE `bud_plan_data` (
  `ref_plan` int NOT NULL,
  `ref_instance` int NOT NULL,
  `ref_item` int NOT NULL,
  `ref_serie` int NOT NULL,
  `ref_campaign` int NOT NULL,
  `ref_info` int NOT NULL,
  `competence` int NOT NULL,
  `value` double NOT NULL,
  UNIQUE KEY `ref_plan` (`ref_plan`,`ref_instance`,`ref_item`,`ref_serie`,`ref_campaign`,`competence`),
  KEY `bud_plan_data_plan` (`ref_plan`),
  KEY `bud_plan_data_instance` (`ref_instance`),
  KEY `bud_plan_data_item` (`ref_item`),
  KEY `bud_plan_data_serie` (`ref_serie`),
  KEY `bud_plan_data_campaign` (`ref_campaign`),
  KEY `bud_plan_data_info` (`ref_info`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_plan_data`
--


--
-- Table structure for table `bud_plan_detail_data`
--

CREATE TABLE `bud_plan_detail_data` (
  `ref_plan` int NOT NULL,
  `ref_instance` int NOT NULL,
  `ref_detail` int NOT NULL,
  `ref_serie` int NOT NULL,
  `competence` int NOT NULL,
  `amount` double DEFAULT NULL,
  `value` double NOT NULL,
  `total` double DEFAULT NULL,
  UNIQUE KEY `ref_plan` (`ref_plan`,`ref_instance`,`ref_detail`,`ref_serie`,`competence`),
  KEY `bud_plan_detail_data_plan` (`ref_plan`),
  KEY `bud_plan_detail_data_instance` (`ref_instance`),
  KEY `bud_plan_detail_data_detail` (`ref_detail`),
  KEY `bud_plan_detail_data_serie` (`ref_serie`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_plan_detail_data`
--


--
-- Table structure for table `bud_plan_details`
--

CREATE TABLE `bud_plan_details` (
  `id` int NOT NULL,
  `ref_item` int NOT NULL,
  `ref_instance` int NOT NULL,
  `ref_parent` int NOT NULL,
  `account` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `classification` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bud_plan_details_class` (`classification`),
  KEY `bud_plan_details_ref_item` (`ref_item`),
  KEY `bud_plan_details_ref_instance` (`ref_instance`),
  KEY `bud_plan_details_ref_parent` (`ref_parent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_plan_details`
--


--
-- Table structure for table `bud_plan_items`
--

CREATE TABLE `bud_plan_items` (
  `id` int NOT NULL,
  `ref_plan` int NOT NULL,
  `operation` char(1) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `account` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `classification` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `alias` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `label` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_plan` (`ref_plan`,`alias`),
  KEY `bud_plan_items_plan` (`ref_plan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `bud_plan_items`
--


--
-- Table structure for table `clb_messages`
--

CREATE TABLE `clb_messages` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_thread` int NOT NULL,
  `ref_reply` int NOT NULL,
  `source` int NOT NULL,
  `type` smallint NOT NULL,
  `family` smallint NOT NULL,
  `dt_published` datetime NOT NULL,
  `options` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `subject` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `body` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `clb_messages_user` (`ref_user`),
  KEY `clb_messages_published` (`dt_published`),
  KEY `clb_messages_thread` (`ref_thread`),
  KEY `clb_messages_family` (`family`),
  KEY `clb_messages_source` (`source`),
  KEY `clb_messages_type` (`type`),
  KEY `clb_messages_reply` (`ref_reply`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `clb_messages`
--


--
-- Table structure for table `clb_recipients`
--

CREATE TABLE `clb_recipients` (
  `ref_message` int NOT NULL,
  `ref_user` int NOT NULL,
  `dt_received` date DEFAULT NULL,
  `comment` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  UNIQUE KEY `ref_message` (`ref_message`,`ref_user`),
  KEY `clb_recipients_message` (`ref_message`),
  KEY `clb_recipients_user` (`ref_user`),
  KEY `clb_recipients_received` (`dt_received`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `clb_recipients`
--


--
-- Table structure for table `cmn_annotations`
--

CREATE TABLE `cmn_annotations` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_classification` int NOT NULL,
  `family` smallint NOT NULL,
  `type` smallint NOT NULL,
  `origin` tinyint NOT NULL,
  `dt_start` date NOT NULL,
  `dt_end` date NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_annotations_source` (`family`,`ref_source`),
  KEY `cmn_annotations_item` (`family`,`ref_source`,`dt_start`,`dt_end`),
  KEY `cmn_annotations_class` (`ref_classification`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_annotations`
--


--
-- Table structure for table `cmn_applications`
--

CREATE TABLE `cmn_applications` (
  `ref_owner` int NOT NULL,
  `position` int NOT NULL,
  `application` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `application` (`application`,`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_applications`
--


--
-- Table structure for table `cmn_appointment_items`
--

CREATE TABLE `cmn_appointment_items` (
  `id` int NOT NULL,
  `restriction` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_appointment_items`
--


--
-- Table structure for table `cmn_appointment_participants`
--

CREATE TABLE `cmn_appointment_participants` (
  `ref_appointment` int NOT NULL,
  `ref_user` int NOT NULL,
  `state` int NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  KEY `cmn_appoin_part_appointment` (`ref_appointment`),
  KEY `cmn_appoin_part_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_appointment_participants`
--


--
-- Table structure for table `cmn_appointments`
--

CREATE TABLE `cmn_appointments` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_author` int NOT NULL,
  `ref_original` int NOT NULL,
  `ref_item` int NOT NULL,
  `family` int NOT NULL,
  `recurrence` int NOT NULL,
  `notice` tinyint NOT NULL,
  `options` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `title` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `location` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ts_start` datetime NOT NULL,
  `ts_end` datetime NOT NULL,
  `dt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_appointments_original` (`ref_original`),
  KEY `cmn_appointments_item` (`ref_item`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_appointments`
--


--
-- Table structure for table `cmn_calendar_exceptions`
--

CREATE TABLE `cmn_calendar_exceptions` (
  `id` int NOT NULL,
  `ref_calendar` int NOT NULL,
  `dt_start` date DEFAULT NULL,
  `dt_end` date DEFAULT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_calendar_exceptions_cal` (`ref_calendar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_calendar_exceptions`
--


--
-- Table structure for table `cmn_calendar_schedules`
--

CREATE TABLE `cmn_calendar_schedules` (
  `id` int NOT NULL,
  `ref_calendar` int NOT NULL,
  `week_day` smallint NOT NULL,
  `tm_begin` time DEFAULT NULL,
  `tm_end` time DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_calendar_schedules_cal` (`ref_calendar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_calendar_schedules`
--

INSERT INTO `cmn_calendar_schedules` VALUES (0,0,2,'08:00:00','12:00:00'),(1,0,2,'13:30:00','18:00:00'),(2,0,3,'08:00:00','12:00:00'),(3,0,3,'13:30:00','18:00:00'),(4,0,4,'08:00:00','12:00:00'),(5,0,4,'13:30:00','18:00:00'),(6,0,5,'08:00:00','12:00:00'),(7,0,5,'13:30:00','18:00:00'),(8,0,6,'08:00:00','12:00:00'),(9,0,6,'13:30:00','18:00:00');

--
-- Table structure for table `cmn_calendar_users`
--

CREATE TABLE `cmn_calendar_users` (
  `ref_calendar` int NOT NULL,
  `ref_user` int NOT NULL,
  `begin_tolerance` int NOT NULL,
  `end_tolerance` int NOT NULL,
  `control_type` tinyint NOT NULL,
  UNIQUE KEY `ref_calendar` (`ref_calendar`,`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_calendar_users`
--

INSERT INTO `cmn_calendar_users` VALUES (0,1,0,0,1),(0,2,0,0,1),(0,3,0,0,0),(0,4,0,0,0);

--
-- Table structure for table `cmn_calendars`
--

CREATE TABLE `cmn_calendars` (
  `id` int NOT NULL,
  `ref_project` int NOT NULL,
  `ref_calendar` int NOT NULL,
  `begin_tolerance` int NOT NULL,
  `end_tolerance` int NOT NULL,
  `login_control` tinyint NOT NULL,
  `is_default` tinyint NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_calendars_cal` (`ref_calendar`),
  KEY `cmn_calendars_ref_proj` (`ref_project`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_calendars`
--

INSERT INTO `cmn_calendars` VALUES (0,0,0,0,0,0,1,'DEFAULT');

--
-- Table structure for table `cmn_checklists`
--

CREATE TABLE `cmn_checklists` (
  `id` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_category` int NOT NULL,
  `type` int NOT NULL,
  `family` tinyint NOT NULL,
  `state` tinyint NOT NULL,
  `max_result` double NOT NULL,
  `limit_match` double NOT NULL,
  `limit_lower` double NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_cmn_checklists_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_checklists`
--


--
-- Table structure for table `cmn_classifications`
--

CREATE TABLE `cmn_classifications` (
  `id` int NOT NULL,
  `family` smallint NOT NULL,
  `state` smallint NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_classifications`
--


--
-- Table structure for table `cmn_contacts`
--

CREATE TABLE `cmn_contacts` (
  `id` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `email` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `id` (`id`,`name`,`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_contacts`
--


--
-- Table structure for table `cmn_context`
--

CREATE TABLE `cmn_context` (
  `id` int NOT NULL,
  `ref_model` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_owner` int NOT NULL,
  `item_size` int NOT NULL,
  `family` smallint NOT NULL,
  `ts_created` timestamp NULL DEFAULT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `url` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_context_model` (`ref_model`),
  KEY `cmn_context_source` (`ref_source`),
  KEY `cmn_context_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_context`
--


--
-- Table structure for table `cmn_default_values`
--

CREATE TABLE `cmn_default_values` (
  `ref_defaults` int NOT NULL,
  `seq_no` smallint NOT NULL,
  `value` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_defaults` (`ref_defaults`,`seq_no`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_default_values`
--


--
-- Table structure for table `cmn_defaults`
--

CREATE TABLE `cmn_defaults` (
  `id` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_defaults`
--


--
-- Table structure for table `cmn_digital_signatures`
--

CREATE TABLE `cmn_digital_signatures` (
  `id` int NOT NULL,
  `ref_file` int NOT NULL,
  `ref_user` int NOT NULL,
  `size` int NOT NULL,
  `family` int NOT NULL,
  `dt_signature` datetime DEFAULT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `uuid` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `signature` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  `stamps` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  PRIMARY KEY (`id`),
  KEY `cmn_digital_signatures_file` (`ref_file`),
  KEY `cmn_digital_signatures_user` (`ref_user`),
  KEY `cmn_digital_signatures_date` (`dt_signature`),
  KEY `cmn_digital_signatures_name` (`name`),
  KEY `cmn_digital_signatures_uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_digital_signatures`
--


--
-- Table structure for table `cmn_domains`
--

CREATE TABLE `cmn_domains` (
  `id` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_domains`
--


--
-- Table structure for table `cmn_employee_hierarchy`
--

CREATE TABLE `cmn_employee_hierarchy` (
  `id` int NOT NULL,
  `ref_employment` int NOT NULL,
  `ref_parent` int NOT NULL,
  `ref_root` int NOT NULL,
  `ref_substitute` int NOT NULL,
  `fl_principal` int NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_parent` (`ref_parent`),
  KEY `cmn_employee_hierarchy_employment` (`ref_employment`),
  KEY `cmn_employee_hierarchy_ref_parent` (`ref_parent`),
  KEY `cmn_employee_hierarchy_root` (`ref_root`),
  KEY `cmn_employee_hierarchy_substitute` (`ref_substitute`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_employee_hierarchy`
--


--
-- Table structure for table `cmn_employments`
--

CREATE TABLE `cmn_employments` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_function` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_unit` int NOT NULL,
  `ref_department` int NOT NULL,
  `ref_sector` int NOT NULL,
  `is_default` tinyint NOT NULL,
  `state` tinyint NOT NULL,
  `dt_from` date DEFAULT NULL,
  `dt_until` date DEFAULT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_function` (`ref_function`,`ref_user`),
  KEY `cmn_employments_category` (`ref_category`),
  KEY `cmn_employments_unit` (`ref_unit`),
  KEY `cmn_employments_department` (`ref_department`),
  KEY `cmn_employments_sector` (`ref_sector`),
  KEY `cmn_employments_user` (`ref_user`),
  KEY `cmn_employments_function` (`ref_function`),
  KEY `cmn_employments_state` (`state`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_employments`
--

INSERT INTO `cmn_employments` VALUES (1,1,1,0,1,1,1,1,1,NULL,NULL,''),(2,3,1,0,1,1,1,1,1,NULL,NULL,''),(3,4,1,0,1,1,1,1,1,NULL,NULL,'');

--
-- Table structure for table `cmn_entity_team`
--

CREATE TABLE `cmn_entity_team` (
  `ref_entity` int NOT NULL,
  `ref_owner` int NOT NULL,
  UNIQUE KEY `ref_entity` (`ref_entity`,`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_entity_team`
--


--
-- Table structure for table `cmn_feed_fields`
--

CREATE TABLE `cmn_feed_fields` (
  `ref_feed` int NOT NULL,
  `sequence` smallint NOT NULL,
  `label` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `value` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_feed` (`ref_feed`,`label`),
  KEY `cmn_feed_fields_feed` (`ref_feed`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_feed_fields`
--


--
-- Table structure for table `cmn_feeds`
--

CREATE TABLE `cmn_feeds` (
  `id` int NOT NULL,
  `ref_owner` int NOT NULL,
  `family` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `protocol` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `subcaption` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ts_executed` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_feeds_family` (`family`),
  KEY `cmn_feeds_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_feeds`
--


--
-- Table structure for table `cmn_functions`
--

CREATE TABLE `cmn_functions` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_type_function` int NOT NULL,
  `state` int NOT NULL,
  `sex` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `age` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `salary` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `experience` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_functions_category` (`ref_category`),
  KEY `cmn_functions_type` (`ref_type_function`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_functions`
--

INSERT INTO `cmn_functions` VALUES (1,1,2,0,'','','','Default','','');

--
-- Table structure for table `cmn_history`
--

CREATE TABLE `cmn_history` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_author` int NOT NULL,
  `family` int NOT NULL,
  `dt_created` date NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_history`
--


--
-- Table structure for table `cmn_indexations`
--

CREATE TABLE `cmn_indexations` (
  `id` int NOT NULL,
  `family` int NOT NULL,
  `source` int NOT NULL,
  `size` int NOT NULL,
  `state` tinyint NOT NULL,
  `duration` double DEFAULT NULL,
  `rate` double DEFAULT NULL,
  `dt_started` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `dt_finished` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_indexations`
--


--
-- Table structure for table `cmn_info`
--

CREATE TABLE `cmn_info` (
  `id` int NOT NULL,
  `family` tinyint NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_info`
--


--
-- Table structure for table `cmn_item_controllers`
--

CREATE TABLE `cmn_item_controllers` (
  `ref_owner` int NOT NULL,
  `ref_source` int NOT NULL,
  `type` tinyint NOT NULL,
  UNIQUE KEY `type` (`type`,`ref_owner`,`ref_source`),
  KEY `ix_cmn_item_controllers_type` (`type`),
  KEY `ix_cmn_item_controllers_owner` (`ref_owner`),
  KEY `ix_cmn_item_controllers_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_item_controllers`
--


--
-- Table structure for table `cmn_lifecycle`
--

CREATE TABLE `cmn_lifecycle` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_source` int NOT NULL,
  `from_user` int NOT NULL,
  `to_user` int NOT NULL,
  `family` smallint NOT NULL,
  `origin` smallint NOT NULL,
  `action` smallint NOT NULL,
  `from_state` smallint NOT NULL,
  `to_state` smallint NOT NULL,
  `dt_created` timestamp NULL DEFAULT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_lifecycle_user` (`ref_user`),
  KEY `cmn_lifecycle_family` (`family`),
  KEY `cmn_lifecycle_source` (`ref_source`),
  KEY `cmn_lifecycle_created` (`dt_created`),
  KEY `cmn_lifecycle_origin` (`origin`),
  KEY `cmn_lifecycle_action` (`action`),
  KEY `cmn_lifecycle_from_state` (`from_state`),
  KEY `cmn_lifecycle_from_user` (`from_user`),
  KEY `cmn_lifecycle_to_state` (`to_state`),
  KEY `cmn_lifecycle_to_user` (`to_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_lifecycle`
--

INSERT INTO `cmn_lifecycle` VALUES (1,1,3,0,0,16,1,2,0,0,'2022-10-13 14:56:18','Usuário cadastrado.'),(2,1,4,0,0,16,1,2,0,0,'2022-10-13 14:56:51','Usuário cadastrado.');

--
-- Table structure for table `cmn_locks`
--

CREATE TABLE `cmn_locks` (
  `ref_source` int NOT NULL,
  `ref_login` int NOT NULL,
  `family` smallint NOT NULL,
  `dt_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  UNIQUE KEY `family` (`family`,`ref_source`),
  KEY `cmn_locks_login` (`ref_login`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_locks`
--


--
-- Table structure for table `cmn_logbooks`
--

CREATE TABLE `cmn_logbooks` (
  `id` int NOT NULL,
  `ref_author` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_classification` int NOT NULL,
  `restriction` int NOT NULL,
  `type` smallint NOT NULL,
  `dt_start` date NOT NULL,
  `dt_end` date NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_logbook_author` (`ref_author`),
  KEY `cmn_logbook_user` (`ref_user`),
  KEY `cmn_logbook_class` (`ref_classification`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_logbooks`
--


--
-- Table structure for table `cmn_logins`
--

CREATE TABLE `cmn_logins` (
  `ref_user` int NOT NULL,
  `session` int NOT NULL,
  `dt_login` datetime NOT NULL,
  `dt_logout` datetime DEFAULT NULL,
  `origin` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`session`),
  KEY `cmn_logins_user` (`ref_user`),
  KEY `cmn_logins_login` (`dt_login`),
  KEY `cmn_logins_logout` (`dt_logout`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_logins`
--

INSERT INTO `cmn_logins` VALUES (1,1,'2022-10-13 11:49:13','2022-10-13 15:21:59','OK:127.0.0.1:sas'),(1,2,'2022-10-13 13:58:16','2022-10-13 17:47:08','OK:177.220.209.51:sas'),(1,3,'2022-10-13 14:56:07','2022-10-13 18:54:02','OK:177.220.209.51:sas'),(4,4,'2022-10-13 15:49:00','2022-10-13 18:56:16','OK:177.220.209.51:barbara.rodrigues'),(4,5,'2022-10-13 16:02:30','2022-10-13 20:34:03','OK:177.220.209.51:barbara.rodrigues'),(3,6,'2022-10-14 12:10:00','2022-10-14 15:11:43','OK:177.38.156.39:ia'),(3,7,'2022-10-14 12:11:52','2022-10-14 15:58:07','OK:177.38.156.39:ia');

--
-- Table structure for table `cmn_membership`
--

CREATE TABLE `cmn_membership` (
  `ref_group` int NOT NULL,
  `ref_user` int NOT NULL,
  UNIQUE KEY `ref_group` (`ref_group`,`ref_user`),
  KEY `cmn_membership_group` (`ref_group`),
  KEY `cmn_membership_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_membership`
--


--
-- Table structure for table `cmn_notifications`
--

CREATE TABLE `cmn_notifications` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_from` int NOT NULL,
  `ref_to` int NOT NULL,
  `delivered` tinyint NOT NULL,
  `event` smallint NOT NULL,
  `type` smallint NOT NULL,
  `dt_sent` date NOT NULL,
  `message` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_notifications`
--


--
-- Table structure for table `cmn_properties`
--

CREATE TABLE `cmn_properties` (
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_properties`
--

INSERT INTO `cmn_properties` VALUES ('ac.schema','80.3'),('am.schema','80.3'),('aud.schema','80.3'),('bi.schema','80.3'),('bpm.schema','80.3'),('brm.schema','80.3'),('bsc.schema','80.3'),('bud.schema','80.3'),('clb.schema','80.3'),('cmn.schema','80.3'),('crm.schema','80.3'),('crt.schema','80.3'),('dat.schema','80.3'),('db.id','e589b0c7-bd09-466a-bf8f-1f4d0ffe1928'),('dms.schema','80.3'),('EXT#8.0.3-03-delete-ratingapplications-without-rater','2'),('EXT#8.0.3-batch-job-binds-start-process','2'),('EXT#8.0.3-UpdateDocumentFolderType','2'),('ext.schema','80.3'),('fav.schema','80.3'),('ftr_cm.schema','80.3'),('hrm.schema','80.3'),('im.schema','80.3'),('lic.schema','80.3'),('mob.schema','80.3'),('orm.schema','80.3'),('P26N:Producao','5a48fdb3cdb48287'),('prj.schema','80.3'),('qms.schema','80.3'),('SchemaVersion','80.3'),('snap.schema','80.3'),('svc.schema','80.3'),('vfs.schema','80.3'),('wd.schema','80.3'),('web.schema','80.3');

--
-- Table structure for table `cmn_requirements`
--

CREATE TABLE `cmn_requirements` (
  `id` int NOT NULL,
  `ref_rule` int NOT NULL,
  `classification` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_requirements_rule` (`ref_rule`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_requirements`
--


--
-- Table structure for table `cmn_resource_usages`
--

CREATE TABLE `cmn_resource_usages` (
  `id` int NOT NULL,
  `ref_resource` int NOT NULL,
  `ref_user` int NOT NULL,
  `purpose` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `dt_from` date NOT NULL,
  `dt_until` date NOT NULL,
  `tm_from` time NOT NULL,
  `tm_until` time NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_resource_usage_resource` (`ref_resource`),
  KEY `cmn_resource_usage_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_resource_usages`
--


--
-- Table structure for table `cmn_resources`
--

CREATE TABLE `cmn_resources` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_resources_category` (`ref_category`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_resources`
--


--
-- Table structure for table `cmn_restrictions`
--

CREATE TABLE `cmn_restrictions` (
  `ref_source` int NOT NULL,
  `restriction` int NOT NULL,
  `type` smallint NOT NULL,
  UNIQUE KEY `restriction` (`restriction`,`ref_source`,`type`),
  KEY `cmn_restrictions_restriction` (`restriction`),
  KEY `cmn_restrictions_type` (`type`),
  KEY `cmn_restrictions_source` (`type`,`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_restrictions`
--


--
-- Table structure for table `cmn_roles`
--

CREATE TABLE `cmn_roles` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `permission` tinyint NOT NULL,
  `role` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `role` (`role`,`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_roles`
--

INSERT INTO `cmn_roles` VALUES (1,2,1,'anonymous.app.documents'),(2,2,1,'anonymous.app.occurrences'),(3,2,1,'anonymous.app.survey');

--
-- Table structure for table `cmn_scale_items`
--

CREATE TABLE `cmn_scale_items` (
  `id` int NOT NULL,
  `ref_scale` int NOT NULL,
  `position` int NOT NULL,
  `weight` double NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_cmn_scale_items_scale` (`ref_scale`),
  KEY `ix_cmn_scale_items_position` (`position`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_scale_items`
--


--
-- Table structure for table `cmn_scales`
--

CREATE TABLE `cmn_scales` (
  `id` int NOT NULL,
  `state` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_scales`
--


--
-- Table structure for table `cmn_sequences`
--

CREATE TABLE `cmn_sequences` (
  `id` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_sequences`
--

INSERT INTO `cmn_sequences` VALUES (23,'bpm_attributes.id'),(6,'cmn_categories.id'),(3,'cmn_employments.id'),(2,'cmn_lifecycle.id'),(7,'cmn_logins.\"session\"'),(41,'cmn_spotlight_topics.id'),(2,'cmn_tag_families.id'),(22,'cmn_tag_kinds.id'),(4,'cmn_users.id'),(3515,'ext_batch_jobs.id'),(1,'hrm_classifications_scales.id'),(5,'hrm_classification_scale_items.id'),(31,'vfs_files.id'),(3,'vfs_folders.id'),(2,'ws_accesses.id'),(1,'ws_contracts.id');

--
-- Table structure for table `cmn_serials`
--

CREATE TABLE `cmn_serials` (
  `id` int NOT NULL,
  `ref_domain` int NOT NULL,
  `start_value` int NOT NULL,
  `current_value` int NOT NULL,
  `pattern` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(120) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_domain` (`ref_domain`,`pattern`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_serials`
--


--
-- Table structure for table `cmn_snaps`
--

CREATE TABLE `cmn_snaps` (
  `ref_source` int NOT NULL,
  `ref_user` int NOT NULL,
  `family` smallint NOT NULL,
  UNIQUE KEY `ref_source` (`ref_source`,`ref_user`,`family`),
  KEY `cmn_snaps_user` (`ref_user`),
  KEY `cmn_snaps_source` (`family`,`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_snaps`
--


--
-- Table structure for table `cmn_spotlight_readers`
--

CREATE TABLE `cmn_spotlight_readers` (
  `id` int NOT NULL,
  `ref_topic` int NOT NULL,
  `ref_user` int NOT NULL,
  `stars` tinyint DEFAULT NULL,
  `bookmark` tinyint DEFAULT NULL,
  `ts_read` datetime DEFAULT NULL,
  `feedback` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_topic` (`ref_topic`,`ref_user`),
  KEY `cmn_spot_readers_topic` (`ref_topic`),
  KEY `cmn_spot_readers_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_spotlight_readers`
--


--
-- Table structure for table `cmn_spotlight_topics`
--

CREATE TABLE `cmn_spotlight_topics` (
  `id` int NOT NULL,
  `language` char(2) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ts_published` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `topic` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `title` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `author` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `contact` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `item` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `banner` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `category` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `uuid` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `topic` (`topic`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_spotlight_topics`
--

INSERT INTO `cmn_spotlight_topics` VALUES (1,'ES','2022-01-19 00:00:00','lectura-de-documentos','LECTURA DE DOCUMENTOS EN SU MÓVIL','Interact','products@interact.com.br','7.0.28','#52394','SA Mobile','860db95f-d999-4dc5-b71b-719b03f3d863','Realice la confirmación de lectura de Documentos del Portafolio en el SA Go!'),(2,'ES','2022-01-05 00:00:00','compare-evaluaciones-de-riesgo','COMPARE EVALUACIONES DE RIESGO','Interact','products@interact.com.br','7.0.28','#52396','SA Risk Manager','32a1301b-7164-4d95-a9b4-101007e1ffe4','La gestión de riesgos viene ganando espacio y se convierte cada vez más importante para las empresas.'),(3,'ES','2022-01-12 00:00:00','novedades-del-sa-bpm','NOVEDADES DEL SA PROCESS MANAGER','Interact','products@interact.com.br','7.0.28','#52395','SA Process Manager','2ce9ce4d-ee78-426c-934c-180d6fd82261','Nuevas funcionalidades para garantizar una actuación automática, estandarizada y eficiente de los procesos.'),(4,'ES','2021-12-01 00:00:00','forecast-es','FORECAST','Interact','products@interact.com.br','7.0.26','#46269','SA Budget Manager','80dd3a4e-1cce-4376-812f-93822af8d817','Ajuste su presupuesto para tener un mayor control durante el Ciclo Presupuestario.'),(5,'ES','2021-11-24 00:00:00','firma-digital-en-los-procesos','FIRMA DIGITAL EN LOS PROCESOS','Interact','products@interact.com.br','7.0.28','#45981','SA Process Manager','fe69e611-e9a9-4b70-92b7-1d6aa9994b28','Compruebe la nueva funcionalidad de la firma digital en los procesos, una forma segura de firmar los documentos.'),(6,'ES','2021-11-18 00:00:00','automatice-la-alimentacion-de-sus-indicadores-2','AUTOMATICE LA ALIMENTACIÓN DE SUS INDICADORES','Interact','products@interact.com.br','Todos','#45706','SA System Manager','11fc33f2-428d-4e4b-aa3f-0f550f13b165','Elimine la operación repetitiva y manual de alimentación para mayor seguridad, confianza y comodidad.'),(7,'ES','2021-11-03 00:00:00','comparacion-de-presupuestos-e-instancias','COMPARACIÓN DE PRESUPUESTOS E INSTANCIAS','Interact','products@interact.com.br','7.0.27','#46269','SA Budget Manager','692cf473-726f-4359-9afe-767964e7489a','Nueva herramienta de análisis para una gestión de presupuestos más sólida.'),(8,'ES','2021-10-27 00:00:00','encuestas-publicas','ENCUESTAS PÚBLICAS','Interact','products@interact.com.br','7.0.27','#45821','SA Survey Manager','d629ee05-0bac-4fbc-b91b-a1c8d92eff29','Aproveche esta nueva opción para recoger más respuestas desde el mismo dispositivo.'),(9,'ES','2021-10-20 00:00:00','gestion-agil-en-su-organizacion','GESTIÓN ÁGIL EN SU ORGANIZACIÓN','Interact','products@interact.com.br','7.0.27','#45818','SA Components','8633d33e-0a6e-4090-bd63-797b66167ae7','Integre todo el trabajo de su equipo en un único espacio compartido.'),(10,'ES','2021-10-13 00:00:00','evaluacion-integrada-de-colaboradores','EVALUACIÓN INTEGRADA DE COLABORADORES','Interact','products@interact.com.br','7.0.27','#45813','SA Competence Manager','6319fded-8ab2-4825-b649-c44c267c9a24','Profundice en la evaluación del desempeño y aprenda a estimular el potencial de los colaboradores, a mejorar su productividad y a encontrar a los líderes del mañana.'),(11,'ES','2021-10-06 00:00:00','evolucion-del-sa-risk-manager','EVOLUCIÓN DEL SA RISK MANAGER','Interact','products@interact.com.br','7.0.27','#45811','SA Risk Manager','88d3707d-ec50-4b8b-96b4-6090f8b11e25','Más flexibilidad y trazabilidad para un mejor control de los resultados.'),(12,'ES','2021-09-29 00:00:00','copia-de-items','COPIA DE ÍTEMS','Interact','products@interact.com.br','Todos','#45815','SA Performance Manager','4e2521d2-aff1-4a8b-b398-a46bec6ce58f','Descubra cómo redefinir su planificación estratégica a partir de un modelo existente.'),(13,'ES','2021-09-22 00:00:00','usabilidad-el-usuario-en-el-centro','USABILIDAD: EL USUARIO EN EL CENTRO','Interact','products@interact.com.br','8.0.0','#48393','Suite SA','ae3fcdd3-ec7c-4e49-9eff-febe0819929e','Mayores renovaciones visuales para estar a la altura de los nuevos tiempos.'),(14,'ES','2021-09-15 00:00:00','lanzamiento-de-la-version-8-0','LANZAMIENTO DE LA VERSIÓN 8 DE LA SUITE SA','Interact','products@interact.com.br','8.0.0','#48236','Suite SA','2dd08a99-e016-4404-a966-a9c9edd16da7','Conozca las principales mejoras de la Suite SA lanzadas en la versión 8.0.0'),(15,'PT','2021-09-09 00:00:00','lancamento-da-versao-8-0-1','LANÇAMENTO DA VERSÃO 8.0.1','Interact','products@interact.com.br','8.0.1','#50275','Suite SA','4145015d-c7a1-403a-ab70-9c3aa7c7dcde','Em contínua evolução, adicionamos à Suite SA novas ferramentas e recursos!'),(16,'ES','2021-08-11 00:00:00','nuevas-posibilidades-en-la-suite-sa','NUEVAS POSIBILIDADES EN LA SUITE SA','Interact','products@interact.com.br','7.0.26','#45806','Suite SA','f358392e-093d-463e-873d-3ca9c6b98bad','Nuevos desafíos y paradigmas nos influencian a crear un sistema cada vez más inteligente, seguro e integrado. Vea las posibilidades:'),(17,'ES','2021-08-03 00:00:00','sepa-como-utilizar-teleconferencia-de-la-mejor-forma-posible','SEPA CÓMO UTILIZAR TELECONFERENCIA DE LA MEJOR FORMA POSIBLE','Interact','products@interact.com.br','7.0.25','#45808','SA Components','03477aae-f0b4-47fa-a395-6bc6d84d6bf8','La Teleconferencia surgió de la necesidad de conectar y aproximar personas de una forma simple y segura.'),(18,'ES','2021-07-20 00:00:00','nuevos-elementos-notacion-bpmn-2-0','NUEVOS ELEMENTOS: NOTACIÓN BPMN 2.0','Interact','products@interact.com.br','7.0.27','#46129','SA Process Manager','015c51be-641f-4785-abb4-15f2d3be3f42','Los procesos conceptuales han ganado nuevos elementos. Vea los detalles en el vídeo:'),(19,'PT','2021-05-06 00:00:00','usabilidade-o-usuario-no-centro','USABILIDADE: O USUÁRIO NO CENTRO','Interact','products@interact.com.br','8.0.0','#48393','Suite SA','a5a4c21b-24ca-4ef5-8772-5ad8d0c34664','Grandes renovações visuais para acompanhar os novos tempos.'),(20,'PT','2021-03-29 00:00:00','lancamento-da-versao-7-0-28','LANÇAMENTO DA VERSÃO 7.0.28','Interact','products@interact.com.br','7.0.28','#45821','Suite SA','1186599c-f662-4dac-a35e-45e49a124d71','Confira as principais melhorias da Suite SA Strategic Adviser lançadas na versão 7.0.28.'),(21,'ES','2021-03-16 00:00:00','desbloqueo-de-usuarios-en-el-sa','DESBLOQUEO DE USUARIOS EN EL SA','Interact','products@interact.com.br','Todos','#45817','Suite SA','af9da9b1-c4ef-4189-9d8e-afebfd1d4297','¿Ya se ha quedado sin acceso al superar el número consecutivo de intentos de inicio de sesión? Vea los detalles en el video:'),(22,'PT','2021-01-19 00:00:00','forecast-maior-controle-durante-o-ciclo-orcamentario','FORECAST: MAIOR CONTROLE DURANTE O CICLO ORÇAMENTÁRIO','Interact','products@interact.com.br','7.0.26','#46269','SA Budget Manager','dc1d20cd-90b0-409a-81b3-9aa99117e373','Alcance os resultados esperados da sua organização. Entenda como utilizar o recurso de Forecast:'),(23,'ES','2021-01-14 00:00:00','nueva-norma-para-edicion-de-presentaciones-y-dashboards','NUEVA NORMA PARA EDICIÓN DE PRESENTACIONES Y DASHBOARDS','Interact','products@interact.com.br','7.0.24','#45816','SA Components','cb9ad1d3-4303-4cd4-af40-ed88e79817e7','Esté atento al hacer edición en Presentaciones y Dashboards!'),(24,'ES','2021-01-12 00:00:00','campos-condicionales-en-los-formularios-mas-practico','CAMPOS CONDICIONALES EN LOS FORMULARIOS: MÁS PRÁCTICO','Interact','products@interact.com.br','Todos','#45810','SA Occurrence Manager','183eb221-69b3-4c3d-ac1e-47771b2e956f','Explore la posibilidad de definir condiciones entre los campos, al crear el formulario en el Tipo de Ocurrencia!'),(25,'PT','2021-01-12 00:00:00','novos-elementos-notacao-bpmn-2-0-2','NOVOS ELEMENTOS: NOTAÇÃO BPMN 2.0','Interact','products@interact.com.br','7.0.27','#46129','SA Process Manager','fd4e84b0-0c41-4826-8b2c-e1e934745a3d','Os processos conceituais do módulo SA Process Manager e a aplicação Workflow Designer ganharam novos elementos. Confira no vídeo:'),(26,'PT','2021-01-05 00:00:00','assinatura-digital-em-processos','ASSINATURA DIGITAL EM PROCESSOS','Interact','products@interact.com.br','7.0.27','#45982','SA Process Manager','cd9891fa-74b7-4ddb-8dc7-35a46b80842c','Confira a nova funcionalidade de assinatura digital em processos, uma maneira segura de assinar documentos que necessitam transitar em um meio eletrônico.'),(27,'ES','2021-01-05 00:00:00','mi-agenda','MI AGENDA','Interact','products@interact.com.br','Todos','#45809','SA Home','8d15bb34-45ce-49ca-9cc5-1300973d7782','Sus pendientes y notificaciones centralizadas en un solo lugar!'),(28,'PT','2021-04-27 00:00:00','lancamento-da-versao-8','LANÇAMENTO DA VERSÃO 8 DA SUITE SA','Interact','products@interact.com.br','8.0.0','#48236','Suite SA','c1a49a18-c3a2-4219-b793-3a46bd0c4921','Confira as principais melhorias da Suite SA lançadas na versão 8.0.0'),(29,'PT','2021-04-01 00:00:00','matrizes-de-acompanhamento-de-projetos','MATRIZES DE ACOMPANHAMENTO DE PROJETOS','Interact','products@interact.com.br','7.0.28','#48242','SA Project Manager','0ed14150-b724-4785-953b-d54482481100','Sabendo da importância de registrar e centralizar informações em um projeto, disponibilizamos 3 matrizes no SA Project Manager.'),(30,'PT','2022-10-07 00:00:00','destaques-da-8-0-4','DESTAQUES DA 8.0.4','Interact','products@interact.com.br','8.0.4','#56928','Suite SA','c36ff09d-15c1-4906-a646-d48644ba0eb8','Venha entender o que mudou com a Release 8.0.4.'),(31,'ES','2022-09-28 00:00:00','auditorias-offline-es','APLIQUE AUDITORÍAS OFFLINE','Interact','products@interact.com.br','Todos','#56813','SA Pocket','588af36a-3cf6-406d-98c8-1b4311a0bec7','Con el nuevo SA Pocket usted realiza los análisis a cualquier hora, en cualquier lugar.'),(32,'PT','2022-09-21 00:00:00','auditorias-offline','APLIQUE AUDITORIAS OFFLINE','Interact','products@interact.com.br','Todos','#56813','SA Pocket','7840c2ae-7df6-446e-8e37-1c61967fc840','Com o novíssimo SA Pocket você realiza as análises a qualquer hora, em qualquer lugar.'),(33,'ES','2022-08-25 09:50:35','novedades-de-la-release-8-0-3','NOVEDADES DE LA RELEASE 8.0.3','Interact','products@interact.com.br','8.0.3','#55613','Suite SA','b291304b-c951-4b80-9f34-1e48ab7e2b82','Vea algunas de las principales novedades de esta versión.'),(34,'PT','2022-07-28 00:00:00','novidades-da-release-8-0-3','NOVIDADES DA RELEASE 8.0.3','Interact','products@interact.com.br','8.0.3','#55613','Suite SA','47dc2f91-6a99-4a2c-806b-b977db92c7c3','Contemple algumas das principais novidades dessa versão.'),(35,'ES','2022-07-07 00:00:00','gobierno-corporativo','GOBIERNO CORPORATIVO','Interact','products@interact.com.br','8.0.3','#55296','SA Governance Manager','d7d053ec-1033-4d6f-b2e8-fa4447318ec1','Sistema completo de Gobierno Corporativo 4.0.'),(36,'PT','2022-07-06 00:00:00','lancamento-da-versao-8-0-3','LANÇAMENTO DA VERSÃO 8.0.3','Interact','products@interact.com.br','8.0.3','#55321','Suite SA','c2c7733d-0d93-4653-a10a-cad4ef744695','Confira as principais melhorias da Suite SA Strategic Adviser lançadas na versão 8.0.3.'),(37,'PT','2022-06-30 00:00:00','governanca-corporativa','GOVERNANÇA CORPORATIVA','Interact','products@interact.com.br','8.0.3','#55296','SA Governance Manager','f70d53d0-e4ba-477b-ade1-64583bfe7c76','As melhores práticas para uma gestão 4.0.'),(38,'ES','2022-04-27 00:00:00','estandarizacion-de-indicadores-2','ESTANDARIZACIÓN DE INDICADORES','Interact','products@interact.com.br','Todos','#53737','SA Performance Manager','bfd23290-2b6b-4100-a600-3d4d42603308','La Suite SA puede estandarizar las configuraciones de uno o más indicadores de una sola vez. ¡Vea más!'),(39,'PT','2022-04-27 00:00:00','padronize-seus-indicadores','PADRONIZE SEUS INDICADORES','Interact','products@interact.com.br','Todos','#53737','SA Performance Manager','82193bd3-09e3-4fda-8ba4-b5fc580e269b','A Suite SA permite que padronizar vários indicadores de uma só vez. Veja mais!'),(40,'PT','2022-02-07 00:00:00','lancamento-da-versao-8-0-2','LANÇAMENTO DA VERSÃO 8.0.2','Interact','products@interact.com.br','8.0.2','#52392','Suite SA','24ed1ff2-d097-4eac-9006-36161b4c996f','Suite SA ganha novos recursos para melhorar a gestão das empresas'),(41,'ES','2022-01-05 00:00:00','matrices-de-seguimiento-de-proyectos','MATRICES DE SEGUIMIENTO DE PROYECTOS','Interact','products@interact.com.br','7.0.28','#52335','SA Project Manager','29436acf-4953-406c-941f-9a4a51d46a8f','Las matrices de Comunicación, Adquisición y Responsabilidad son herramientas importantes para que la gestión de sus proyectos sea más efectiva y transparente.');

--
-- Table structure for table `cmn_tag_mappings`
--

CREATE TABLE `cmn_tag_mappings` (
  `ref_source` int NOT NULL,
  `ref_kind` int NOT NULL,
  `ref_template` int NOT NULL,
  `type` int NOT NULL,
  `position` int NOT NULL,
  `content` varchar(4000) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  KEY `cmn_tag_mappings_template` (`ref_template`),
  KEY `cmn_tag_mappings_kind` (`ref_kind`),
  KEY `cmn_tag_mappings_source` (`ref_source`),
  KEY `cmn_tag_mappings_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_tag_mappings`
--

INSERT INTO `cmn_tag_mappings` VALUES (1,3,0,1,0,'0'),(1,4,0,1,0,''),(1,5,0,1,0,'');

--
-- Table structure for table `cmn_tag_option_items`
--

CREATE TABLE `cmn_tag_option_items` (
  `id` int NOT NULL,
  `ref_option` int NOT NULL,
  `position` smallint NOT NULL,
  `obsolete` tinyint NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `content` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_option` (`ref_option`,`content`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_tag_option_items`
--


--
-- Table structure for table `cmn_tag_options`
--

CREATE TABLE `cmn_tag_options` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_owner` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cmn_tag_options_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_tag_options`
--


--
-- Table structure for table `cmn_tag_template_kinds`
--

CREATE TABLE `cmn_tag_template_kinds` (
  `ref_template` int NOT NULL,
  `ref_kind` int NOT NULL,
  `position` int NOT NULL,
  UNIQUE KEY `ref_template` (`ref_template`,`ref_kind`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_tag_template_kinds`
--


--
-- Table structure for table `cmn_teams`
--

CREATE TABLE `cmn_teams` (
  `ref_team` int NOT NULL,
  `ref_user` int NOT NULL,
  UNIQUE KEY `ref_team` (`ref_team`,`ref_user`),
  KEY `cmn_teams_team` (`ref_team`),
  KEY `cmn_teams_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_teams`
--


--
-- Table structure for table `cmn_tempfiles`
--

CREATE TABLE `cmn_tempfiles` (
  `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `path` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  KEY `cmn_tempfiles_ts` (`ts`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_tempfiles`
--

INSERT INTO `cmn_tempfiles` VALUES ('2022-10-20 01:30:52','/home/sas/instances/SA8_Current/shared/temp/topic-4461870d-2648-4ed5-814d-85350ede0992.xml');

--
-- Table structure for table `cmn_tips`
--

CREATE TABLE `cmn_tips` (
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ref_user` int NOT NULL,
  KEY `cmn_tips_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_tips`
--


--
-- Table structure for table `cmn_topics`
--

CREATE TABLE `cmn_topics` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `family` smallint NOT NULL,
  `sequence` smallint NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `family` (`family`,`ref_source`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_topics`
--


--
-- Table structure for table `cmn_user_properties`
--

CREATE TABLE `cmn_user_properties` (
  `ref_user` int NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `content` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ts_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  UNIQUE KEY `name` (`name`,`ref_user`),
  KEY `cmn_user_properties_user` (`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_user_properties`
--

INSERT INTO `cmn_user_properties` VALUES (4,'com.interact.sas.web.zk.aud.apps.SASAuditMonitorApplication','0','2022-10-13 15:52:55'),(1,'com.interact.sas.web.zk.bpm.apps.ProcessAdministratorApplication','0','2022-10-13 13:59:03'),(4,'com.interact.sas.web.zk.bsc.apps.PerformanceAdministratorApplication','0','2022-10-13 15:53:48'),(1,'com.interact.sas.web.zk.cmn.apps.CollaboratorApplication','0','2022-10-13 14:56:13'),(3,'com.interact.sas.web.zk.cmn.apps.SASSetupApplication','0','2022-10-14 12:10:26'),(4,'com.interact.sas.web.zk.dms.apps.GlobalRepositoryApplication','0','2022-10-13 15:53:58'),(1,'com.interact.sas.web.zk.ext.apps.SASSessionMonitorApplication','0','2022-10-13 14:16:54'),(3,'com.interact.sas.web.zk.ext.apps.SASSessionMonitorApplication','0','2022-10-14 12:10:17'),(1,'LauncherPane.selectedButton','modules','2022-10-13 14:56:08'),(3,'LauncherPane.selectedButton','modules','2022-10-14 12:11:52'),(4,'LauncherPane.selectedButton','home','2022-10-13 16:02:31'),(1,'LauncherPane.selectedModule','SystemTools','2022-10-13 14:56:08'),(3,'LauncherPane.selectedModule','SystemTools','2022-10-14 12:11:52'),(4,'LauncherPane.selectedModule','DocumentManager','2022-10-13 15:53:55'),(4,'sas/bsc/SelectedPerformanceView','-1','2022-10-13 15:53:48'),(1,'SYSTEM.Users.dds.location','','2022-10-13 13:58:42'),(1,'SYSTEM.Users.dds.reason','','2022-10-13 13:58:42');

--
-- Table structure for table `cmn_workaround`
--

CREATE TABLE `cmn_workaround` (
  `ref_source` int NOT NULL,
  `family` smallint NOT NULL,
  `type` smallint NOT NULL,
  `content` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  KEY `ix_cmn_work_family` (`family`),
  KEY `ix_cmn_work_type` (`type`),
  KEY `ix_cmn_work_ref_source` (`ref_source`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `cmn_workaround`
--


--
-- Table structure for table `crm_account_certifications`
--

CREATE TABLE `crm_account_certifications` (
  `id` int NOT NULL,
  `ref_account` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_account_certifications`
--


--
-- Table structure for table `crm_accounts`
--

CREATE TABLE `crm_accounts` (
  `id` int NOT NULL,
  `ref_creator` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_unit` int NOT NULL,
  `ref_origin` int NOT NULL,
  `ref_rating` int NOT NULL,
  `ref_segment` int NOT NULL,
  `ref_tags` int NOT NULL,
  `category` int NOT NULL,
  `num_employees` int NOT NULL,
  `ref_sla` int DEFAULT NULL,
  `state` smallint NOT NULL,
  `revenue_amount` double NOT NULL,
  `dt_created` date NOT NULL,
  `currency` varchar(3) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `revenue_source` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `company_name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `trading_name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `group_name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_accounts_company_name` (`company_name`),
  KEY `ix_crm_accounts_trading_name` (`trading_name`),
  KEY `crm_accounts_tags` (`ref_tags`),
  KEY `crm_accounts_unit` (`ref_unit`),
  KEY `crm_accounts_state` (`state`),
  KEY `crm_accounts_ref_sla` (`ref_sla`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_accounts`
--


--
-- Table structure for table `crm_activities`
--

CREATE TABLE `crm_activities` (
  `id` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_account` int NOT NULL,
  `ref_opportunity` int NOT NULL,
  `ref_classification_type` int NOT NULL,
  `ref_classification_nature` int DEFAULT NULL,
  `status` smallint NOT NULL,
  `result` smallint NOT NULL,
  `value_investment` double DEFAULT NULL,
  `dt_start` date DEFAULT NULL,
  `dt_end` date DEFAULT NULL,
  `hr_start` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `hr_end` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `subject` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `place` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_activities`
--


--
-- Table structure for table `crm_addresses`
--

CREATE TABLE `crm_addresses` (
  `id` int NOT NULL,
  `ref_account` int NOT NULL,
  `ref_city` int NOT NULL,
  `ref_region` int NOT NULL,
  `zip` varchar(10) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `label` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `domain` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `address` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `complement` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `neighbourhood` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_account` (`ref_account`,`label`),
  KEY `crm_addresses_address` (`address`),
  KEY `crm_addresses_account` (`ref_account`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_addresses`
--


--
-- Table structure for table `crm_cities`
--

CREATE TABLE `crm_cities` (
  `id` int NOT NULL,
  `ref_state` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_state` (`ref_state`,`name`),
  KEY `ix_crm_cities_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_cities`
--


--
-- Table structure for table `crm_classifications`
--

CREATE TABLE `crm_classifications` (
  `id` int NOT NULL,
  `seqno` int NOT NULL,
  `family` smallint NOT NULL,
  `domain` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_classifications_name` (`family`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_classifications`
--

INSERT INTO `crm_classifications` VALUES (1,0,0,'','Standard','Contas padr?úo'),(2,0,0,'','Corporate','Contas diferenciados'),(3,0,0,'','Small Business','Contas menores'),(4,0,1,'','Ag?¬ncia de Publicidade',''),(5,0,1,'','Alimentos',''),(6,0,1,'','Consultoria',''),(7,0,1,'','Constru?º?úo',''),(8,0,1,'','Petroqu?¡mica',''),(9,0,1,'','Hospitalar',''),(10,0,2,'','Revista HSM',''),(11,0,2,'','Evento Hospitalar 2012',''),(12,0,2,'','Mail Marketing',''),(13,0,2,'','Visita',''),(14,0,2,'','Indica?º?úo',''),(15,0,3,'','Decisor Financeiro',''),(16,0,3,'','Decisor T?®cnico',''),(17,0,3,'','Contato Estrat?®gico',''),(18,0,3,'','Sem Influ?¬ncia',''),(19,0,4,'','Favor?ível Interact',''),(20,0,4,'','Favor?ível Concorrente',''),(21,0,4,'','Neutro',''),(22,0,4,'','N?úo identificado',''),(23,0,5,'','Melhor Pre?ºo',''),(24,0,5,'','Melhor Produto',''),(25,0,6,'','Valor Elevado',''),(26,0,6,'','Produto Inferior',''),(27,0,7,'','Licenciamento',''),(28,0,7,'','Loca?º?úo',''),(29,0,7,'','Amplia?º?úo',''),(30,0,7,'','On Demand',''),(31,0,7,'','Capacita?º?úo',''),(32,0,8,'','Proposta',''),(33,0,8,'','Contrato',''),(34,0,8,'','Aceite',''),(35,0,9,'','Produto',''),(36,0,9,'','Servi?ºo','');

--
-- Table structure for table `crm_contacts`
--

CREATE TABLE `crm_contacts` (
  `id` int NOT NULL,
  `ref_account` int NOT NULL,
  `ref_influence` int NOT NULL,
  `ref_position` int NOT NULL,
  `ref_chief` int NOT NULL,
  `dt_birth` date DEFAULT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `department` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `function` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_contacts_name` (`name`),
  KEY `ix_crm_contacts_department` (`department`),
  KEY `ix_crm_contacts_function` (`function`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_contacts`
--


--
-- Table structure for table `crm_countries`
--

CREATE TABLE `crm_countries` (
  `id` int NOT NULL,
  `acronym` varchar(2) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `currency` varchar(3) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `language` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_countries_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_countries`
--

INSERT INTO `crm_countries` VALUES (1,'BR','BRL','Portugu?¬s Brasil','Brasil'),(2,'AR','USD','Espanhol','Argentina'),(3,'CO','USD','Espanhol','Col??mbia'),(4,'MX','USD','Espanhol','M?®xico'),(5,'PE','USD','Espanhol','Peru');

--
-- Table structure for table `crm_identities`
--

CREATE TABLE `crm_identities` (
  `id` int NOT NULL,
  `ref_country` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `mask` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_identities_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_identities`
--

INSERT INTO `crm_identities` VALUES (1,1,'CPF','999.999.999-99'),(2,1,'CNPJ','99.999.999.9999/99');

--
-- Table structure for table `crm_identity_items`
--

CREATE TABLE `crm_identity_items` (
  `id` int NOT NULL,
  `ref_identity` int NOT NULL,
  `ref_source` int NOT NULL,
  `family` int NOT NULL,
  `number` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ref_identity` (`ref_identity`,`number`),
  KEY `crm_identity_items_source` (`ref_source`),
  KEY `crm_identity_items_family` (`family`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_identity_items`
--


--
-- Table structure for table `crm_interactions`
--

CREATE TABLE `crm_interactions` (
  `id` int NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `ref_owner` int NOT NULL,
  `ref_ticket` int NOT NULL,
  `type` tinyint NOT NULL,
  `origin` tinyint NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_interactions_owner` (`ref_owner`),
  KEY `idx_crm_interactions_ticket` (`ref_ticket`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_interactions`
--


--
-- Table structure for table `crm_item_types`
--

CREATE TABLE `crm_item_types` (
  `id` int NOT NULL,
  `ref_classification` int NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `unit` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_item_types_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_item_types`
--

INSERT INTO `crm_item_types` VALUES (1,35,'Performance Manager','Licen?ºas'),(2,35,'Competence Manager','Licen?ºas'),(3,35,'Survey Manager','Licen?ºas'),(4,35,'Business Process Manager','Licen?ºas'),(5,35,'Contract Manager','Licen?ºas'),(6,35,'Occurrence Manager','Licen?ºas'),(7,35,'Document Manager','Licen?ºas'),(8,35,'Audit Manager','Licen?ºas'),(9,35,'Risk Manager','Licen?ºas'),(10,35,'Business Intelligence','Licen?ºas'),(11,35,'Su?¡te SA - Strategic Adviser','Su?¡te'),(12,36,'Treinamento','Horas'),(13,36,'Projeto','Horas'),(14,36,'Custom','Licen?ºas'),(15,36,'Integra?º?Áes','Licen?ºas');

--
-- Table structure for table `crm_mailings`
--

CREATE TABLE `crm_mailings` (
  `ref_publication` int NOT NULL,
  `ref_subscriber` int NOT NULL,
  `ref_channel` int NOT NULL,
  `num_tracked` int NOT NULL,
  `num_published` int NOT NULL,
  `batch` smallint NOT NULL,
  `state` smallint NOT NULL,
  `type` smallint NOT NULL,
  `ts_tracked` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `ts_processed` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  UNIQUE KEY `ref_publication` (`ref_publication`,`ref_subscriber`,`batch`),
  KEY `ix_crm_mailings_channel` (`ref_channel`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_mailings`
--


--
-- Table structure for table `crm_network_items`
--

CREATE TABLE `crm_network_items` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `ref_network` int NOT NULL,
  `family` int NOT NULL,
  `value` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `crm_network_items_source` (`ref_source`),
  KEY `crm_network_items_family` (`family`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_network_items`
--


--
-- Table structure for table `crm_networks`
--

CREATE TABLE `crm_networks` (
  `id` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `domain` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_networks`
--

INSERT INTO `crm_networks` VALUES (1,'E-mail','.E_MAIL'),(2,'Site','.SITE'),(3,'Newsletter','.SUBSCRIPTION'),(4,'MSN',''),(5,'Skype',''),(6,'Facebook',''),(7,'Linkedin',''),(8,'Twitter',''),(9,'G+','');

--
-- Table structure for table `crm_opportunities`
--

CREATE TABLE `crm_opportunities` (
  `id` int NOT NULL,
  `ref_account` int NOT NULL,
  `ref_contact` int NOT NULL,
  `ref_unit` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_origin` int NOT NULL,
  `ref_status` int NOT NULL,
  `ref_result_reason` int NOT NULL,
  `ref_accept_attachment` int NOT NULL,
  `ref_validate_by` int NOT NULL,
  `probability` int NOT NULL,
  `value_total` double NOT NULL,
  `value_discount` double NOT NULL,
  `dt_estimated` date DEFAULT NULL,
  `dt_closed` date DEFAULT NULL,
  `dt_accepted` date DEFAULT NULL,
  `dt_validated` date DEFAULT NULL,
  `dt_created` date NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_opportunities`
--


--
-- Table structure for table `crm_opportunity_attachments`
--

CREATE TABLE `crm_opportunity_attachments` (
  `id` int NOT NULL,
  `ref_opportunity` int NOT NULL,
  `ref_classification` int NOT NULL,
  `fileid` int NOT NULL,
  `revision` int NOT NULL,
  `file_name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `dt_created` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_opportunity_attachments`
--


--
-- Table structure for table `crm_opportunity_items`
--

CREATE TABLE `crm_opportunity_items` (
  `id` int NOT NULL,
  `ref_opportunity` int NOT NULL,
  `ref_type` int NOT NULL,
  `quantity` double NOT NULL,
  `value_unit` double NOT NULL,
  `value_total` double NOT NULL,
  `unit` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `remark` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_opportunity_items`
--


--
-- Table structure for table `crm_opportunity_mappings`
--

CREATE TABLE `crm_opportunity_mappings` (
  `ref_opportunity` int NOT NULL,
  `ref_classification` int NOT NULL,
  UNIQUE KEY `ref_opportunity` (`ref_opportunity`,`ref_classification`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_opportunity_mappings`
--


--
-- Table structure for table `crm_phones`
--

CREATE TABLE `crm_phones` (
  `id` int NOT NULL,
  `ref_source` int NOT NULL,
  `family` int NOT NULL,
  `type` smallint NOT NULL,
  `number` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_phones`
--


--
-- Table structure for table `crm_publication_channels`
--

CREATE TABLE `crm_publication_channels` (
  `ref_publication` int NOT NULL,
  `ref_channel` int NOT NULL,
  UNIQUE KEY `ref_publication` (`ref_publication`,`ref_channel`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_publication_channels`
--


--
-- Table structure for table `crm_regions`
--

CREATE TABLE `crm_regions` (
  `id` int NOT NULL,
  `ref_state` int NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_regions`
--


--
-- Table structure for table `crm_service_stages`
--

CREATE TABLE `crm_service_stages` (
  `id` int NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ref_service` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `sequence` int NOT NULL,
  `ref_form` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_service_stages_service` (`ref_service`),
  KEY `idx_crm_service_stages_owner` (`ref_owner`),
  KEY `idx_crm_service_stages_team` (`ref_team`),
  KEY `idx_crm_service_stages_form` (`ref_form`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_service_stages`
--


--
-- Table structure for table `crm_services`
--

CREATE TABLE `crm_services` (
  `id` int NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  `ref_owner` int NOT NULL,
  `ref_team` int NOT NULL,
  `ref_form` int NOT NULL,
  `state` tinyint NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_services_owner` (`ref_owner`),
  KEY `idx_crm_services_team` (`ref_team`),
  KEY `idx_crm_services_form` (`ref_form`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_services`
--


--
-- Table structure for table `crm_sla_instance_stages`
--

CREATE TABLE `crm_sla_instance_stages` (
  `id` int NOT NULL,
  `ref_stage` int NOT NULL,
  `start` time NOT NULL,
  `end` time DEFAULT NULL,
  `ref_sla_instance` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_sla_ins_stage` (`ref_stage`),
  KEY `idx_crm_sla_ins_instance` (`ref_sla_instance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_sla_instance_stages`
--


--
-- Table structure for table `crm_sla_instances`
--

CREATE TABLE `crm_sla_instances` (
  `id` int NOT NULL,
  `ref_sla` int NOT NULL,
  `ref_ticket` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_sla_instances_sla` (`ref_sla`),
  KEY `idx_crm_sla_instances_ticket` (`ref_ticket`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_sla_instances`
--


--
-- Table structure for table `crm_sla_stages`
--

CREATE TABLE `crm_sla_stages` (
  `id` int NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `deadline` time NOT NULL,
  `sequence` int NOT NULL,
  `state` tinyint NOT NULL,
  `ref_sla` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_sla_stages_sla` (`ref_sla`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_sla_stages`
--


--
-- Table structure for table `crm_slas`
--

CREATE TABLE `crm_slas` (
  `id` int NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ref_calendar` int NOT NULL,
  `state` tinyint NOT NULL,
  KEY `idx_crm_slas_calendar` (`ref_calendar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_slas`
--


--
-- Table structure for table `crm_states`
--

CREATE TABLE `crm_states` (
  `id` int NOT NULL,
  `ref_country` int NOT NULL,
  `acronym` varchar(8) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ix_crm_state_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_states`
--

INSERT INTO `crm_states` VALUES (1,1,'RS','Rio Grande do Sul'),(2,1,'SC','Santa Catarina'),(3,1,'PR','Paran?í'),(4,1,'SP','S?úo Paulo'),(5,1,'RJ','Rio de Janeiro'),(6,1,'MG','Minas Gerais'),(7,1,'ES','Esp?¡rito Santo'),(8,1,'BA','Bahia'),(9,1,'MS','Mato Grosso do Sul'),(10,1,'MT','Mato Grosso'),(11,1,'GO','Goi?ís'),(12,1,'DF','Distrito Federal'),(13,1,'TO','Tocantins'),(14,1,'AM','Amazonas'),(15,1,'AC','Acre'),(16,1,'RO','Rond??nia'),(17,1,'RR','Roraima'),(18,1,'PA','Par?í'),(19,1,'AP','Amap?í'),(20,1,'MA','Maranh?úo'),(21,1,'PI','Piau?¡'),(22,1,'RN','Rio Grande do Norte'),(23,1,'CE','Cear?í'),(24,1,'SE','Sergipe'),(25,1,'AL','Alagoas'),(26,1,'PB','Para?¡ba'),(27,1,'PE','Pernambuco');

--
-- Table structure for table `crm_status`
--

CREATE TABLE `crm_status` (
  `id` int NOT NULL,
  `seqno` int NOT NULL,
  `is_closed` smallint NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_status`
--

INSERT INTO `crm_status` VALUES (1,1,0,'Em Negocia?º?úo'),(2,2,0,'Eminente de Fechamento'),(3,3,1,'Fechada - Conquistado'),(4,4,1,'Fechada - Perdido');

--
-- Table structure for table `crm_status_reports`
--

CREATE TABLE `crm_status_reports` (
  `id` int NOT NULL,
  `ref_account` int NOT NULL,
  `ref_opportunity` int NOT NULL,
  `ref_state` int NOT NULL,
  `ref_acknowledged_by` int NOT NULL,
  `ref_author` int NOT NULL,
  `classification` int NOT NULL,
  `probability` int NOT NULL,
  `value_total` double NOT NULL,
  `value_discount` double NOT NULL,
  `dt_created` date NOT NULL,
  `dt_acknowledged` date DEFAULT NULL,
  `dt_estimated` date DEFAULT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_status_reports`
--


--
-- Table structure for table `crm_subscriptions`
--

CREATE TABLE `crm_subscriptions` (
  `ref_subscriber` int NOT NULL,
  `ref_channel` int NOT NULL,
  `state` smallint NOT NULL,
  UNIQUE KEY `ref_subscriber` (`ref_subscriber`,`ref_channel`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_subscriptions`
--


--
-- Table structure for table `crm_tickets`
--

CREATE TABLE `crm_tickets` (
  `id` int NOT NULL,
  `uuid` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `ref_user` int NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `finished` timestamp NULL DEFAULT NULL,
  `ref_child` int NOT NULL,
  `ref_similar` int NOT NULL,
  `state` tinyint NOT NULL,
  `ref_service` int NOT NULL,
  `ref_account` int NOT NULL,
  `ref_sla` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crm_tickets_user` (`ref_user`),
  KEY `idx_crm_tickets_child` (`ref_child`),
  KEY `idx_crm_tickets_similar` (`ref_similar`),
  KEY `idx_crm_tickets_service` (`ref_service`),
  KEY `idx_crm_tickets_account` (`ref_account`),
  KEY `idx_crm_tickets_sla` (`ref_sla`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_tickets`
--


--
-- Table structure for table `crm_trackings`
--

CREATE TABLE `crm_trackings` (
  `ref_publication` int NOT NULL,
  `ref_subscriber` int NOT NULL,
  `ts_tracked` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `origin` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  KEY `ix_crm_trackings_publication` (`ref_publication`),
  KEY `ix_crm_trackings_subscriber` (`ref_subscriber`),
  KEY `ix_crm_trackings_tracked` (`ts_tracked`),
  KEY `ix_crm_trackings_mailing` (`ref_publication`,`ref_subscriber`),
  KEY `ix_crm_trackings_origin` (`origin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crm_trackings`
--


--
-- Table structure for table `crt_answers`
--

CREATE TABLE `crt_answers` (
  `id` int NOT NULL,
  `ref_certification` int NOT NULL,
  `ref_application` int NOT NULL,
  `ref_topic` int NOT NULL,
  `ref_option` int NOT NULL,
  `result` double NOT NULL,
  `score` double NOT NULL,
  `feedback` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `crt_answers_certification` (`ref_certification`),
  KEY `crt_answers_application` (`ref_application`),
  KEY `crt_answers_topic` (`ref_topic`),
  KEY `crt_answers_option` (`ref_option`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_answers`
--


--
-- Table structure for table `crt_applications`
--

CREATE TABLE `crt_applications` (
  `id` int NOT NULL,
  `ref_certification` int NOT NULL,
  `ref_occurrence` int NOT NULL,
  `ref_participant` int NOT NULL,
  `ref_owner` int NOT NULL,
  `competence` int NOT NULL,
  `anonymous` smallint NOT NULL,
  `score` double NOT NULL,
  `dt_occurrence` date DEFAULT NULL,
  `author` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `feedback` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `crt_applications_certification` (`ref_certification`),
  KEY `crt_applications_occurrence` (`ref_occurrence`),
  KEY `crt_applications_participant` (`ref_participant`),
  KEY `crt_applications_owner` (`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_applications`
--


--
-- Table structure for table `crt_constraint_options`
--

CREATE TABLE `crt_constraint_options` (
  `ref_topic` int NOT NULL,
  `ref_option` int NOT NULL,
  UNIQUE KEY `ref_topic` (`ref_topic`,`ref_option`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_constraint_options`
--


--
-- Table structure for table `crt_constraints`
--

CREATE TABLE `crt_constraints` (
  `ref_certification` int NOT NULL,
  `ref_topic` int NOT NULL,
  `ref_condition` int NOT NULL,
  `action` int NOT NULL,
  UNIQUE KEY `ref_topic` (`ref_topic`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_constraints`
--


--
-- Table structure for table `crt_feedback`
--

CREATE TABLE `crt_feedback` (
  `ref_answer` int NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_answer` (`ref_answer`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_feedback`
--


--
-- Table structure for table `crt_hint`
--

CREATE TABLE `crt_hint` (
  `id` int NOT NULL,
  `ref_option` int NOT NULL,
  `type` int NOT NULL,
  `position` int NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_hint`
--


--
-- Table structure for table `crt_indicators`
--

CREATE TABLE `crt_indicators` (
  `ref_certification` int NOT NULL,
  `ref_participant` int NOT NULL,
  `ref_indicator` int NOT NULL,
  `ref_grouping` int NOT NULL,
  UNIQUE KEY `ref_participant` (`ref_participant`,`ref_indicator`,`ref_grouping`),
  KEY `crt_indicators_certification` (`ref_certification`),
  KEY `crt_indicators_participant` (`ref_participant`),
  KEY `crt_indicators_indicator` (`ref_indicator`),
  KEY `crt_indicators_grouping` (`ref_grouping`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_indicators`
--


--
-- Table structure for table `crt_occurrences`
--

CREATE TABLE `crt_occurrences` (
  `id` int NOT NULL,
  `ref_certification` int NOT NULL,
  `competence` int NOT NULL,
  `dt_planned` date DEFAULT NULL,
  `dt_period_start` date DEFAULT NULL,
  `dt_period_end` date DEFAULT NULL,
  `dt_opened` date DEFAULT NULL,
  `dt_closed` date DEFAULT NULL,
  `name` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `feedback` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `crt_occurrence_certification` (`ref_certification`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_occurrences`
--


--
-- Table structure for table `crt_option_items`
--

CREATE TABLE `crt_option_items` (
  `id` int NOT NULL,
  `ref_option` int NOT NULL,
  `position` int NOT NULL,
  `fl_comment` smallint NOT NULL,
  `fl_percent` smallint NOT NULL,
  `score` double NOT NULL,
  `name` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `crt_option_item_option` (`ref_option`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_option_items`
--


--
-- Table structure for table `crt_options`
--

CREATE TABLE `crt_options` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `type` int NOT NULL,
  `rows` int NOT NULL,
  `cols` int NOT NULL,
  `obsolete` smallint NOT NULL,
  `smiles` smallint DEFAULT NULL,
  `name` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_options`
--


--
-- Table structure for table `crt_participants`
--

CREATE TABLE `crt_participants` (
  `ref_entity` int NOT NULL,
  `ref_certification` int NOT NULL,
  `fl_team` smallint NOT NULL,
  `fl_owner` smallint NOT NULL,
  UNIQUE KEY `ref_entity` (`ref_entity`,`ref_certification`,`fl_team`),
  KEY `crt_participants_entity` (`ref_entity`),
  KEY `crt_participants_certification` (`ref_certification`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_participants`
--


--
-- Table structure for table `crt_topic_groups`
--

CREATE TABLE `crt_topic_groups` (
  `id` int NOT NULL,
  `ref_certification` int NOT NULL,
  `label` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `topics` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `crt_topics_groups_cert` (`ref_certification`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_topic_groups`
--


--
-- Table structure for table `crt_words`
--

CREATE TABLE `crt_words` (
  `id` int NOT NULL,
  `word` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `related` varchar(240) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `crt_words`
--


--
-- Table structure for table `dms_access`
--

CREATE TABLE `dms_access` (
  `ref_document` int NOT NULL,
  `ref_user` int NOT NULL,
  `access_count` int NOT NULL,
  `last_access` date DEFAULT NULL,
  UNIQUE KEY `last_access` (`last_access`,`ref_document`,`ref_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_access`
--


--
-- Table structure for table `dms_baseline_documents`
--

CREATE TABLE `dms_baseline_documents` (
  `ref_document` int NOT NULL,
  `ref_baseline_document` int NOT NULL,
  UNIQUE KEY `ref_document` (`ref_document`,`ref_baseline_document`),
  KEY `dms_bas_doc_ref_doc` (`ref_document`),
  KEY `dms_bas_doc_ref_bas_doc` (`ref_baseline_document`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_baseline_documents`
--


--
-- Table structure for table `dms_catalog_items`
--

CREATE TABLE `dms_catalog_items` (
  `id` int NOT NULL,
  `ref_section` int NOT NULL,
  `ref_document` int NOT NULL,
  `ref_parent` int NOT NULL,
  `alias` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `position` smallint NOT NULL,
  `options` int NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `alias` (`alias`),
  KEY `dms_catalog_items_section` (`ref_section`),
  KEY `dms_catalog_items_document` (`ref_document`),
  KEY `dms_catalog_items_parent` (`ref_parent`),
  KEY `dms_catalog_items_posit` (`position`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_catalog_items`
--


--
-- Table structure for table `dms_catalog_sections`
--

CREATE TABLE `dms_catalog_sections` (
  `id` int NOT NULL,
  `ref_page` int NOT NULL,
  `ref_parent` int NOT NULL,
  `title` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `position` smallint NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dms_catalog_sections_page` (`ref_page`),
  KEY `dms_catalog_secs_ref_par` (`ref_parent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_catalog_sections`
--


--
-- Table structure for table `dms_categories`
--

CREATE TABLE `dms_categories` (
  `id` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_serial` int NOT NULL,
  `ref_tags` int NOT NULL,
  `expiration_period` int NOT NULL,
  `expiration_tolerance` int NOT NULL,
  `max_versions` int NOT NULL,
  `fl_default_expiration` smallint NOT NULL,
  `classification` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `options` char(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `classification` (`classification`,`name`),
  KEY `dms_categ_ref_folder` (`ref_folder`),
  KEY `dms_categ_ref_owner` (`ref_owner`),
  KEY `dms_categ_ref_serial` (`ref_serial`),
  KEY `dms_categories_tags` (`ref_tags`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_categories`
--


--
-- Table structure for table `dms_controller_groups`
--

CREATE TABLE `dms_controller_groups` (
  `id` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_team_verified` int NOT NULL,
  `ref_team_approved` int NOT NULL,
  `state` tinyint DEFAULT '1',
  `classification` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dms_control_g_name` (`name`),
  KEY `dms_control_g_class` (`classification`),
  KEY `dms_control_g_ref_owner` (`ref_owner`),
  KEY `dms_control_g_ref_team_ver` (`ref_team_verified`),
  KEY `dms_control_g_ref_team_app` (`ref_team_approved`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_controller_groups`
--


--
-- Table structure for table `dms_controllers`
--

CREATE TABLE `dms_controllers` (
  `ref_category` int NOT NULL,
  `ref_user` int NOT NULL,
  `ref_controller_group` int NOT NULL,
  `stage_position` int NOT NULL,
  `realization_period` int NOT NULL,
  `signature` tinyint NOT NULL,
  `action` smallint NOT NULL,
  `required` smallint NOT NULL,
  `options` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `stage` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_category` (`ref_category`,`ref_user`,`ref_controller_group`,`action`,`stage`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_controllers`
--


--
-- Table structure for table `dms_copies`
--

CREATE TABLE `dms_copies` (
  `ref_document` int NOT NULL,
  `ref_owner` int NOT NULL,
  `dt_obtained` date NOT NULL,
  `local_path` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  UNIQUE KEY `ref_document` (`ref_document`,`ref_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_copies`
--


--
-- Table structure for table `dms_distributions`
--

CREATE TABLE `dms_distributions` (
  `id` int NOT NULL,
  `ref_work` int NOT NULL,
  `ref_owner` int NOT NULL,
  `quantity` smallint NOT NULL,
  `location` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `info` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dms_distributions_ref_owner` (`ref_owner`),
  KEY `dms_distributions_ref_work` (`ref_work`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_distributions`
--


--
-- Table structure for table `dms_documents`
--

CREATE TABLE `dms_documents` (
  `id` int NOT NULL,
  `ref_category` int NOT NULL,
  `ref_folder` int NOT NULL,
  `ref_owner` int NOT NULL,
  `ref_compound` int NOT NULL,
  `ref_distributed` int NOT NULL,
  `ref_rule` int NOT NULL,
  `ref_original` int NOT NULL,
  `ref_tags` int NOT NULL,
  `id_work` int NOT NULL,
  `restriction` int NOT NULL,
  `size` int NOT NULL,
  `release_count` int NOT NULL,
  `quarentine_stage` int NOT NULL,
  `reject_count` int NOT NULL,
  `indexation` tinyint NOT NULL,
  `signature_state` tinyint NOT NULL,
  `autoconversion_state` tinyint NOT NULL,
  `template` tinyint NOT NULL,
  `state` smallint NOT NULL,
  `quarantine` smallint NOT NULL,
  `doc_type` smallint NOT NULL,
  `workflow` smallint NOT NULL,
  `conversion` smallint NOT NULL,
  `conversion_state` smallint NOT NULL,
  `requested` smallint NOT NULL,
  `dt_prorogation` date DEFAULT NULL,
  `dt_creation` date NOT NULL,
  `dt_valid_from` date DEFAULT NULL,
  `dt_valid_until` date DEFAULT NULL,
  `dt_checkin` date DEFAULT NULL,
  `dt_checkout` date DEFAULT NULL,
  `dt_verified` date DEFAULT NULL,
  `dt_approved` date DEFAULT NULL,
  `version` varchar(8) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `code` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `type` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `signature` varchar(42) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  `medium` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `location` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `lifetime` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `disposition` varchar(160) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `name` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `topics` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `justification` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  PRIMARY KEY (`id`),
  KEY `dms_documents_folder` (`ref_folder`),
  KEY `dms_documents_restriction` (`restriction`),
  KEY `dms_documents_state` (`state`),
  KEY `dms_documents_quarantine` (`quarantine`),
  KEY `dms_documents_owner` (`ref_owner`),
  KEY `dms_documents_valid_until` (`dt_valid_until`),
  KEY `dms_documents_work` (`id_work`),
  KEY `dms_documents_name` (`name`),
  KEY `dms_documents_code` (`code`),
  KEY `dms_documents_sig_state` (`signature_state`),
  KEY `dms_documents_tags` (`ref_tags`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `dms_documents`
--


--
