Just had a quick look through some of the issues regarding reformatting.
As an example of the issue (just in case people are not aware), this is a select for a view we have:
select `oi`.`ordersItemsID` AS `ordersItemsID`,`original`.`orderID` AS `orderID`,`original`.`userID` AS `userID`,`original`.`bookingRef` AS `bookingRef`,`oi`.`branchID` AS `branchID`,`oi`.`catID` AS `catID`,`oi`.`itemID` AS `itemID`,`oi`.`eventCatID` AS `eventCatID`,`oi`.`sessionID` AS `sessionID`,`oi`.`eventTime` AS `eventTime`,`oi`.`name` AS `name`,`oi`.`giftaid` AS `giftaid`,`oi`.`qty` AS `qty`,`oi`.`price` AS `price`,`oi`.`baseTotal` AS `baseTotal`,`oi`.`discountPercentage` AS `discountPercentage`,`oi`.`discountAmount` AS `discountAmount`,`oi`.`discountedBaseTotal` AS `discountedBaseTotal`,`oi`.`bookingFee` AS `bookingFee`,`oi`.`bookingFeeSubtotal` AS `bookingFeeSubtotal`,`oi`.`lineTotal` AS `lineTotal`,`getOrdersItemsRedemptionCount`(`oi`.`ordersItemsID`,NULL,NULL) AS `redeemed`,`getOrdersItemsRedemptionLastDate`(`oi`.`ordersItemsID`,NULL,NULL) AS `lastRedeemedAt`,`oi`.`createdAt` AS `createdAt`,`oi`.`updatedAt` AS `updatedAt`,`oi`.`actualUserID` AS `actualUserID`,`oi`.`itemType` AS `itemType`,`oi`.`returnReasonID` AS `returnReasonID`,`oi`.`returnToStock` AS `returnToStock`,`oi`.`discountID` AS `discountID`,`oi`.`parentID` AS `parentID` from `orders_items` `oi` join `orders` `actual` on`oi`.`orderID` = `actual`.`orderID` join `orders` `original` on`actual`.`originalRef` = `original`.`bookingRef` left join `orders_items_adjustments` `oia` on`oi`.`ordersItemsID` = `oia`.`adjustsID` or `oi`.`ordersItemsID` = `oia`.`adjustedByID` where isnull(`oia`.`ordersItemsAdjustmentID`) and `actual`.`paid` = 1
When it is formatted using HeidiSQL, it looks like ...
SELECT `oi`.`ordersItemsID` AS `ordersItemsID`,`original`.`orderID` AS `orderID`,`original`.`userID` AS `userID`,`original`.`bookingRef` AS `bookingRef`,`oi`.`branchID` AS `branchID`,`oi`.`catID` AS `catID`,`oi`.`itemID` AS `itemID`,`oi`.`eventCatID` AS `eventCatID`,`oi`.`sessionID` AS `sessionID`,`oi`.`eventTime` AS `eventTime`,`oi`.`name` AS `name`,`oi`.`giftaid` AS `giftaid`,`oi`.`qty` AS `qty`,`oi`.`price` AS `price`,`oi`.`baseTotal` AS `baseTotal`,`oi`.`discountPercentage` AS `discountPercentage`,`oi`.`discountAmount` AS `discountAmount`,`oi`.`discountedBaseTotal` AS `discountedBaseTotal`,`oi`.`bookingFee` AS `bookingFee`,`oi`.`bookingFeeSubtotal` AS `bookingFeeSubtotal`,`oi`.`lineTotal` AS `lineTotal`,`getOrdersItemsRedemptionCount`(`oi`.`ordersItemsID`, NULL, NULL) AS `redeemed`,`getOrdersItemsRedemptionLastDate`(`oi`.`ordersItemsID`, NULL, NULL) AS `lastRedeemedAt`,`oi`.`createdAt` AS `createdAt`,`oi`.`updatedAt` AS `updatedAt`,`oi`.`actualUserID` AS `actualUserID`,`oi`.`itemType` AS `itemType`,`oi`.`returnReasonID` AS `returnReasonID`,`oi`.`returnToStock` AS `returnToStock`,`oi`.`discountID` AS `discountID`,`oi`.`parentID` AS `parentID`
FROM `orders_items` `oi`
JOIN `orders` `actual` ON`oi`.`orderID` = `actual`.`orderID`
JOIN `orders` `original` ON`actual`.`originalRef` = `original`.`bookingRef`
LEFT JOIN `orders_items_adjustments` `oia` ON`oi`.`ordersItemsID` = `oia`.`adjustsID` OR `oi`.`ordersItemsID` = `oia`.`adjustedByID`
WHERE ISNULL(`oia`.`ordersItemsAdjustmentID`) AND `actual`.`paid` = 1
When I reformat it using PHPStorm (other rather excellent IDEs may be available), I get ...
SELECT
`oi`.`ordersItemsID` AS `ordersItemsID`,
`original`.`orderID` AS `orderID`,
`original`.`userID` AS `userID`,
`original`.`bookingRef` AS `bookingRef`,
`oi`.`branchID` AS `branchID`,
`oi`.`catID` AS `catID`,
`oi`.`itemID` AS `itemID`,
`oi`.`eventCatID` AS `eventCatID`,
`oi`.`sessionID` AS `sessionID`,
`oi`.`eventTime` AS `eventTime`,
`oi`.`name` AS `name`,
`oi`.`giftaid` AS `giftaid`,
`oi`.`qty` AS `qty`,
`oi`.`price` AS `price`,
`oi`.`baseTotal` AS `baseTotal`,
`oi`.`discountPercentage` AS `discountPercentage`,
`oi`.`discountAmount` AS `discountAmount`,
`oi`.`discountedBaseTotal` AS `discountedBaseTotal`,
`oi`.`bookingFee` AS `bookingFee`,
`oi`.`bookingFeeSubtotal` AS `bookingFeeSubtotal`,
`oi`.`lineTotal` AS `lineTotal`,
`getOrdersItemsRedemptionCount`(`oi`.`ordersItemsID`, NULL, NULL) AS `redeemed`,
`getOrdersItemsRedemptionLastDate`(`oi`.`ordersItemsID`, NULL, NULL) AS `lastRedeemedAt`,
`oi`.`createdAt` AS `createdAt`,
`oi`.`updatedAt` AS `updatedAt`,
`oi`.`actualUserID` AS `actualUserID`,
`oi`.`itemType` AS `itemType`,
`oi`.`returnReasonID` AS `returnReasonID`,
`oi`.`returnToStock` AS `returnToStock`,
`oi`.`discountID` AS `discountID`,
`oi`.`parentID` AS `parentID`
FROM
`orders_items` `oi`
JOIN
`orders` `actual`
ON `oi`.`orderID` = `actual`.`orderID`
JOIN
`orders` `original`
ON `actual`.`originalRef` = `original`.`bookingRef`
LEFT JOIN
`orders_items_adjustments` `oia`
ON
`oi`.`ordersItemsID` = `oia`.`adjustsID`
OR
`oi`.`ordersItemsID` = `oia`.`adjustedByID`
WHERE
ISNULL(`oia`.`ordersItemsAdjustmentID`)
AND
`actual`.`paid` = 1
Whilst this does produce a lot of white space, I find this so much more readable than either of the 2 previous forms.
ANY advancement on this feature would be ideal.