This one goes out to all those fickle fans who stumble here via Google.
If you use Movable Type 4 and have any very long templates you may have encountered a problem where saving the template in MT’s editor results in the end of your template being cut off.
I’ve finally discovered (via a message to ProNet by Brad Choate in April 2008) that this happens if your MT install was originally version 3. These days MT4 stores the template text in a MySQL column of type MEDIUMTEXT, which can store 16MB. MT3 used type TEXT which can only store 64K.
The various upgrade processes between then and now have failed to include this change. So if you find your long templates are being truncated you may want to apply this command to your MySQL database:
ALTER TABLE mt_template MODIFY template_text MEDIUMTEXT;
Obviously, do so at your own risk, etc, etc. I’ve no idea if there are other columns that should be similarly adjusted. Or why this has been neglected by upgrade processes. But it fixes this particular problem.
(Thanks to Adam Rice for pointing me at the solution.)