Skip to content

Commit

Permalink
Having the views in the schema is no good
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Rafter committed Jun 14, 2010
1 parent a5b4b9f commit 1017804
Showing 1 changed file with 0 additions and 150 deletions.
150 changes: 0 additions & 150 deletions db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2867,97 +2867,6 @@ CREATE TABLE `users` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Temporary table structure for view `v_encounter_mdt`
--

DROP TABLE IF EXISTS `v_encounter_mdt`;
/*!50001 DROP VIEW IF EXISTS `v_encounter_mdt`*/;
/*!50001 CREATE TABLE `v_encounter_mdt` (
`patient_id` int(11),
`encounter_type` int(11),
`encounter_datetime` datetime
) */;

--
-- Temporary table structure for view `v_encounter_mr`
--

DROP TABLE IF EXISTS `v_encounter_mr`;
/*!50001 DROP VIEW IF EXISTS `v_encounter_mr`*/;
/*!50001 CREATE TABLE `v_encounter_mr` (
`encounter_id` int(11),
`encounter_type` int(11),
`patient_id` int(11),
`provider_id` int(11),
`location_id` int(11),
`form_id` int(11),
`encounter_datetime` datetime,
`creator` int(11),
`date_created` datetime,
`voided` smallint(6),
`voided_by` int(11),
`date_voided` datetime,
`void_reason` varchar(255)
) */;

--
-- Temporary table structure for view `v_feeding_first`
--

DROP TABLE IF EXISTS `v_feeding_first`;
/*!50001 DROP VIEW IF EXISTS `v_feeding_first`*/;
/*!50001 CREATE TABLE `v_feeding_first` (
`person_id` int(11),
`value_coded` int(11),
`obs_datetime` datetime
) */;

--
-- Temporary table structure for view `v_feeding_last`
--

DROP TABLE IF EXISTS `v_feeding_last`;
/*!50001 DROP VIEW IF EXISTS `v_feeding_last`*/;
/*!50001 CREATE TABLE `v_feeding_last` (
`person_id` int(11),
`value_coded` int(11),
`obs_datetime` datetime
) */;

--
-- Temporary table structure for view `v_max_edt`
--

DROP TABLE IF EXISTS `v_max_edt`;
/*!50001 DROP VIEW IF EXISTS `v_max_edt`*/;
/*!50001 CREATE TABLE `v_max_edt` (
`patient_id` int(11),
`encounter_type` int(11),
`encounter_datetime` datetime
) */;

--
-- Temporary table structure for view `v_patient_state_mr`
--

DROP TABLE IF EXISTS `v_patient_state_mr`;
/*!50001 DROP VIEW IF EXISTS `v_patient_state_mr`*/;
/*!50001 CREATE TABLE `v_patient_state_mr` (
`patient_state_id` int(11),
`patient_program_id` int(11),
`state` int(11),
`start_date` date,
`end_date` date,
`creator` int(11),
`date_created` datetime,
`changed_by` int(11),
`date_changed` datetime,
`voided` smallint(6),
`voided_by` int(11),
`date_voided` datetime,
`void_reason` varchar(255)
) */;

--
-- Table structure for table `weight_for_height`
Expand Down Expand Up @@ -3031,65 +2940,6 @@ CREATE TABLE `weight_height_for_ages` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;

--
-- Final view structure for view `v_encounter_mdt`
--

/*!50001 DROP TABLE `v_encounter_mdt`*/;
/*!50001 DROP VIEW IF EXISTS `v_encounter_mdt`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`openmrs`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_encounter_mdt` AS select `encounter`.`patient_id` AS `patient_id`,`encounter`.`encounter_type` AS `encounter_type`,max(`encounter`.`encounter_datetime`) AS `encounter_datetime` from `encounter` where (`encounter`.`voided` = 0) group by `encounter`.`patient_id`,`encounter`.`encounter_type` */;

--
-- Final view structure for view `v_encounter_mr`
--

/*!50001 DROP TABLE `v_encounter_mr`*/;
/*!50001 DROP VIEW IF EXISTS `v_encounter_mr`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`openmrs`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_encounter_mr` AS select `e`.`encounter_id` AS `encounter_id`,`e`.`encounter_type` AS `encounter_type`,`e`.`patient_id` AS `patient_id`,`e`.`provider_id` AS `provider_id`,`e`.`location_id` AS `location_id`,`e`.`form_id` AS `form_id`,`e`.`encounter_datetime` AS `encounter_datetime`,`e`.`creator` AS `creator`,`e`.`date_created` AS `date_created`,`e`.`voided` AS `voided`,`e`.`voided_by` AS `voided_by`,`e`.`date_voided` AS `date_voided`,`e`.`void_reason` AS `void_reason` from (`encounter` `e` join `v_encounter_mdt` `mdt` on(((`e`.`patient_id` = `mdt`.`patient_id`) and (`e`.`encounter_type` = `mdt`.`encounter_type`) and (`e`.`encounter_datetime` = `mdt`.`encounter_datetime`) and (`e`.`voided` = 0)))) group by `e`.`patient_id`,`e`.`encounter_type` */;

--
-- Final view structure for view `v_feeding_first`
--

/*!50001 DROP TABLE `v_feeding_first`*/;
/*!50001 DROP VIEW IF EXISTS `v_feeding_first`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`openmrs`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_feeding_first` AS select `obs`.`person_id` AS `person_id`,`obs`.`value_coded` AS `value_coded`,min(`obs`.`obs_datetime`) AS `obs_datetime` from `obs` where ((`obs`.`concept_id` = 1151) and (`obs`.`voided` = 0)) group by `obs`.`person_id`,`obs`.`value_coded` */;

--
-- Final view structure for view `v_feeding_last`
--

/*!50001 DROP TABLE `v_feeding_last`*/;
/*!50001 DROP VIEW IF EXISTS `v_feeding_last`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`openmrs`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_feeding_last` AS select `obs`.`person_id` AS `person_id`,`obs`.`value_coded` AS `value_coded`,min(`obs`.`obs_datetime`) AS `obs_datetime` from `obs` where ((`obs`.`concept_id` = 1151) and (`obs`.`voided` = 0)) group by `obs`.`person_id`,`obs`.`value_coded` */;

--
-- Final view structure for view `v_max_edt`
--

/*!50001 DROP TABLE `v_max_edt`*/;
/*!50001 DROP VIEW IF EXISTS `v_max_edt`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`openmrs`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_max_edt` AS select `encounter`.`patient_id` AS `patient_id`,`encounter`.`encounter_type` AS `encounter_type`,max(`encounter`.`encounter_datetime`) AS `encounter_datetime` from `encounter` where (`encounter`.`voided` = 0) group by `encounter`.`patient_id`,`encounter`.`encounter_type` */;

--
-- Final view structure for view `v_patient_state_mr`
--

/*!50001 DROP TABLE `v_patient_state_mr`*/;
/*!50001 DROP VIEW IF EXISTS `v_patient_state_mr`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`openmrs`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_patient_state_mr` AS select `patient_state`.`patient_state_id` AS `patient_state_id`,`patient_state`.`patient_program_id` AS `patient_program_id`,`patient_state`.`state` AS `state`,`patient_state`.`start_date` AS `start_date`,`patient_state`.`end_date` AS `end_date`,`patient_state`.`creator` AS `creator`,`patient_state`.`date_created` AS `date_created`,`patient_state`.`changed_by` AS `changed_by`,`patient_state`.`date_changed` AS `date_changed`,`patient_state`.`voided` AS `voided`,`patient_state`.`voided_by` AS `voided_by`,`patient_state`.`date_voided` AS `date_voided`,`patient_state`.`void_reason` AS `void_reason` from `patient_state` where `patient_state`.`patient_state_id` in (select max(`patient_state`.`patient_state_id`) AS `MAX(patient_state_id)` from `patient_state` where (`patient_state`.`voided` = 0) group by `patient_state`.`patient_program_id`) */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
Expand Down

0 comments on commit 1017804

Please sign in to comment.