 USE `ica`;
 CREATE  OR REPLACE VIEW `contents_langs_summary` AS
 SELECT
-	tbl_lang.content_id AS content_id,
-	tbl_lang.id AS lang_id,
-	tbl_lang.lang AS lang,
-	tbl_state.id AS state_id,
-	tbl_state.state AS state,
-	tbl_rev.id AS rev_id,
-	tbl_rev.content AS content
+  tbl_lang.content_id AS content_id,
+  tbl_lang.id AS lang_id,
+  tbl_lang.lang AS lang,
+  tbl_state.id AS state_id,
+  tbl_state.state AS state,
+  tbl_rev.id AS rev_id,
+  tbl_rev.content AS content
 FROM `contents_langs` AS tbl_lang
 LEFT JOIN `contents_langs_state_latest` AS tbl_state_latest
-	ON tbl_state_latest.lang_id = tbl_lang.id
+  ON tbl_state_latest.lang_id = tbl_lang.id
 LEFT JOIN `contents_langs_rev_latest` AS tbl_rev_latest
-	ON tbl_rev_latest.lang_id = tbl_lang.id
+  ON tbl_rev_latest.lang_id = tbl_lang.id
 LEFT JOIN `contents_langs_states` AS tbl_state
-	ON tbl_state.id = tbl_state_latest.state_id
+  ON tbl_state.id = tbl_state_latest.state_id
 LEFT JOIN `contents_langs_revs` AS tbl_rev
-	ON tbl_rev.id = tbl_rev_latest.rev_id;
+  ON tbl_rev.id = tbl_rev_latest.rev_id;
 
 -- -----------------------------------------------------
 -- View `ica`.`contents_langs_state_latest`

USE `ica`;
CREATE  OR REPLACE VIEW `contents_langs_rev_latest` AS
SELECT
	tbl_rev.lang_id AS lang_id,
	MAX(tbl_rev.id) AS rev_id
FROM `contents_langs_revs` AS tbl_rev
GROUP BY lang_id;


USE `ica`;
CREATE  OR REPLACE VIEW `responses_summary` AS
SELECT
  tbl_response.id AS response_id,
  tbl_state.id AS state_id,
  tbl_state.state AS state,
  tbl_response.message_id AS message_id,
  tbl_response.author_id AS author_id,
  tbl_response.authored AS authored
FROM `responses` AS tbl_response
LEFT JOIN `jointsources_state_latest` AS tbl_state_latest
  ON tbl_state_latest.jointsource_id = tbl_response.id
LEFT JOIN `jointsources_states` AS tbl_state
  ON tbl_state.id = tbl_state_latest.state_id;

-- -----------------------------------------------------
-- View `ica`.`jointsources_responses_summary`
