Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4164 (closed defect: worksforme)

Opened 3 years ago

Last modified 2 years ago

Can't create a LongBlob column from migration

Reported by: squeegy@beautifulpixel.com Assigned to: David
Priority: normal Milestone:
Component: ActiveRecord Version: 1.0.0
Severity: normal Keywords:
Cc:

Description

At least under MySQL migration can't create a LongBlob or MediumBlob column. The following code simply create a binary column that is too small for a lot of uses.

create_table :files do |t|
  t.column :data, :binary, :null => false
end

I'm not sure about the best way to handle it though. Maybe the MySQL adapter could clue in a high limit. Or perhaps the type could be one of :binary, :binary_medium, :binary_large.

Change History

03/09/06 21:14:07 changed by david

  • status changed from new to closed.
  • resolution set to worksforme.

In MySQL 4.1 and above, you can specify the length on a blob or text by using size. It'll automatically expand to the right type. Example:

create_table :files do |t|
  t.column :data, :binary, :null => false, :size => 400000
end

09/01/06 00:16:08 changed by anonymous

  • severity changed from trivial to normal.
  • cc deleted.
  • component set to ActionMailer.
  • summary changed from Can to Can't create a LongBlob column from migration.
  • priority set to normal.
  • keywords deleted.
  • type changed from task to defect.

01/07/07 10:55:05 changed by bitsweat

  • component changed from ActionMailer to ActiveRecord.