Answers.Body: <blockquote>
    <p>Why is LongText supported but not LongBlob for Craft records?</p>
  </blockquote>
  
  <p>Support, mainly... and there hasn't been a demand for it (you're the first to ask that I'm aware of).</p>
  
  <p>Currently Craft's PHP based database backup logic chokes on MySQL datatypes that can't be represented as textual data.</p>
  
  <p>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.</p>
  
  <p>We also plan on updating the backup logic to be able to handle non-textual datatypes.</p>
  
  <p>In the meantime, if you want this in Craft 2, you'll have to move that attribute/column out of an <a href="https://craftcms.com/docs/plugins/records" rel="nofollow">Active Record</a>, create it with a <a href="https://craftcms.com/docs/plugins/migrations" rel="nofollow">migration</a> and have your service layer use <a href="https://craftcms.com/classreference/etc/db/DbCommand" rel="nofollow">DbCommand</a> to interact with it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-30T11:31:34.113Z
Answers.Text: 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.
Answers.UserDisplayName: Merlin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-26T20:54:16.207Z
Answers.LastActivityDate: 2016-08-26T20:54:16.207Z
Answers.UserDisplayName: Brad Bell
Body: <p>Why is <code>LongText</code> supported but not <code>LongBlob</code> 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 <code>blob</code> to <code>longblob</code>), without having to change any core Craft code?</p>
  
  <p>Currently my field looks like that:</p>
  
  <pre><code>'data_blob' =&gt;   array(AttributeType::String, 'column' =&gt; ColumnType::Binary),
  </code></pre>
  
  <p>I'd like to be able to have <code>LongBinary</code> (or <code>longblob</code> in mysql) as I'm reaching the max length for <code>blob</code> and my data is getting truncated. </p>
  
Tags: <plugin-development><database>
Title: Supporting LongBlob / LongBinary in Craft record ColumnType
ThreadText: # Supporting LongBlob / LongBinary in Craft record ColumnType
  
  (Asked by: username_0 on 2016-08-25)
  
  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.
  
  **Tags:** plugin-development, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-26. Score: 1 | Accepted answer
  
  > 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](https://craftcms.com/docs/plugins/records), create it with a [migration](https://craftcms.com/docs/plugins/migrations) and have your service layer use [DbCommand](https://craftcms.com/classreference/etc/db/DbCommand) to interact with it.
  
  > **Comments:**
  > **username_0**: 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.  
  
  ---
  
  