Web Development

There are ton of data types you can use on multiple RDBMS. You can use a text, integer, enum, string or blob. In Rails ActiveRecord, it is normal to use string. String is in fact the default data type(a column will be become a string if you don’t explicitly define another data type).

How to use BLOB as the data type in Rails ActiveRecord

class AddMonthsToNyC240 < ActiveRecord::Migration
  def self.up
    add_column :ny_c240s, :weeks52, :binary, :limit => 10.megabyte
  end
  def self.down
    remove_column :ny_c240s, :weeks52
  end
end
== 20161029155357 AddMonthsToNyC240: migrating ================================
-- add_column(:ny_c240s, :weeks52, :binary, {:limit=>10485760})
   -> 0.1093s
== 20161029155357 AddMonthsToNyC240: migrated (0.1095s) =======================

Blob created!