Skip to content

Instantly share code, notes, and snippets.

@chrisroos
Created February 14, 2011 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisroos/825859 to your computer and use it in GitHub Desktop.
Save chrisroos/825859 to your computer and use it in GitHub Desktop.
A test of whether the ActiveRecord ruby schema format supports bigints
# Create a table in a migration, testing both :integer with a limit of 8, and a :bigint
create_table :people, :force => true do |t|
t.column :col_1, :integer, :limit => 8
t.column :col_2, :bigint
t.column :col_3, :integer
end
# This is the table represented by the ruby schema format.
create_table "people", :force => true do |t|
t.integer "col_1", :limit => 8
t.integer "col_2", :limit => 8
t.integer "col_3"
end
# This is the table represented in the sql format. You can see that both col_1 and col_2 have been created as bigints.
CREATE TABLE `people` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`col_1` bigint(20) DEFAULT NULL,
`col_2` bigint(20) DEFAULT NULL,
`col_3` int(11) DEFAULT 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