views:

449

answers:

1

I'm trying to write a migration that adds a LONGBLOB column to a table in a MySQL database. I'd like to use LONGBLOB instead of BLOB so that I can store more data in the binary column. The problem is that it adds a BLOB column even though I specify a larger size.

Here's the line I'm using to add the column:

add_column :db_files, :data, :binary, :null => false, :size => 1.megabyte

Am I doing this incorrectly?

+4  A: 

The following will create a MEDIUMBLOB field. Use 16.megabyte to go to a LONGBLOB.

def self.up
  create_table "blob_test", :force => true do |t|
    t.column :data, :binary, :limit => 10.megabyte
  end
end

Reference from Ryan Heath's blog.

Michael Glenn