Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Created February 11, 2013 19:54
Show Gist options
  • Select an option

  • Save kenmazaika/4757077 to your computer and use it in GitHub Desktop.

Select an option

Save kenmazaika/4757077 to your computer and use it in GitHub Desktop.
class CreateYolos < ActiveRecord::Migration
def change
create_table :yolos do |t|
# The correct way to add a `longtext` field to table
t.text :swag, :limit => 0xffffffff
t.timestamps
end
end
end
mysql> show create table yolos;
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| yolos | CREATE TABLE `yolos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`swag` longtext COLLATE utf8_unicode_ci,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment