Create Custom Column types in Rails Migrations

The Problem

Your doing migrations for a database and you must specify a column with a database specific type. You've checked all of the ActiveRecord migration options and none fit the bill.

An Example Situation

You must specify bigint or int2vector or polygon for a PostgreSQL database.

The Solution

Here's what you can do to solve the problem of ActiveRecord migration limitations for column types:

create_table :special_table do |t|
t.column :name, :string, :limit => 100
t.column :some_foreign_key, :integer
t.columns << 'some_big_integer bigint'
t.columns << 'a_polygon polygon'