Why is LongText supported but not LongBlob for Craft records? Is it because of the reliance on Yii? Is there some way I can circumvent that and hard-code that change to the DB, (i.e. changing a field from blob to longblob), without having to change any core Craft code?

Currently my field looks like that:

'data_blob' =>   array(AttributeType::String, 'column' => ColumnType::Binary),

I'd like to be able to have LongBinary (or longblob in mysql) as I'm reaching the max length for blob and my data is getting truncated.


Why is LongText supported but not LongBlob for Craft records?

Support, mainly... and there hasn't been a demand for it (you're the first to ask that I'm aware of).

Currently Craft's PHP based database backup logic chokes on MySQL datatypes that can't be represented as textual data.

For the upcoming Craft 3, we've done away with the AttributeType magic and you've got more direct/exact control over how your want your schema to be defined.

We also plan on updating the backup logic to be able to handle non-textual datatypes.

In the meantime, if you want this in Craft 2, you'll have to move that attribute/column out of an Active Record, create it with a migration and have your service layer use DbCommand to interact with it.

  • thanks! The backup logic is actually working for me currently with binary data stored in the DB. Happy to hear about the craft 3 updates though! I'll prepare for that then.
    – Merlin
    Aug 30 '16 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.