Last active
December 2, 2015 13:55
-
-
Save patrickallaert/52e4346e7cb38032eab2 to your computer and use it in GitHub Desktop.
Utility to compare eZ Publish Content Types from multiple environments (e.g. dev / staging / production). -- https://twitter.com/patrick_allaert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim -d \ | |
<(echo 'CALL display_classes();' | mysql -h devHost database --skip_column_names) \ | |
<(echo 'CALL display_classes();' | mysql -h stagingHost database --skip_column_names) \ | |
<(echo 'CALL display_classes();' | mysql -h productionHost database --skip_column_names) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS display_classes; | |
DELIMITER $$ | |
CREATE PROCEDURE display_classes() | |
BEGIN | |
DECLARE done INT DEFAULT FALSE; | |
DECLARE id_, always_available_, is_container_ INT DEFAULT 0; | |
DECLARE identifier_, contentobject_name_ VARCHAR(255) DEFAULT ''; | |
DECLARE contentclass_cur CURSOR FOR SELECT id, identifier, always_available, contentobject_name, is_container FROM ezcontentclass ORDER BY identifier; | |
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; | |
OPEN contentclass_cur; | |
read_loop: LOOP | |
FETCH contentclass_cur INTO id_, identifier_, always_available_, contentobject_name_, is_container_; | |
IF done THEN | |
LEAVE read_loop; | |
END IF; | |
SELECT identifier_; | |
SELECT '========================='; | |
SELECT CONCAT('id: ', id_); | |
SELECT CONCAT('always_available: ', always_available_); | |
SELECT CONCAT('contentobject_name: ', contentobject_name_); | |
SELECT CONCAT('is_container: ', is_container_); | |
SELECT ''; | |
SELECT 'attributes:'; | |
SELECT '-----------'; | |
SELECT identifier, data_type_string, if(is_required, 'required', 'not required'), if(is_searchable, 'searchable', 'not searchable'), if(can_translate, 'translatable', 'not translatable') | |
FROM ezcontentclass_attribute | |
WHERE contentclass_id = id_ | |
ORDER BY placement; | |
SELECT ''; | |
SELECT ''; | |
END LOOP; | |
CLOSE contentclass_cur; | |
END$$ | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment