Created
November 14, 2009 05:47
-
-
Save choonkeat/234400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wrt http://stackoverflow.com/questions/1066340/how-to-use-long-id-in-rails-applications | |
# and http://rubyforge.org/tracker/index.php?func=detail&aid=24387&group_id=4550&atid=17562 | |
bash$ rake db:migrate | |
(in /Users/choonkeat/test/testbigint) | |
== CreateMessages: migrating ================================================= | |
-- create_table(:messages) | |
-> 0.0966s | |
== CreateMessages: migrated (0.0967s) ======================================== | |
bash$ ruby -rconfig/environment script/populate.rb | |
1 #<Message id: 1, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
3 #<Message id: 3, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
15 #<Message id: 15, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
255 #<Message id: 255, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
65535 #<Message id: 65535, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
4294967295 #<Message id: 2147483647, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
18446744073709551615 #<Message id: 2147483647, content: nil, created_at: "2009-11-14 05:43:53", updated_at: "2009-11-14 05:43:53"> | |
bash$ echo 'ActiveRecord::ConnectionAdapters::MysqlAdapter::NATIVE_DATABASE_TYPES[:primary_key] = "BIGINT UNSIGNED DEFAULT NULL auto_increment PRIMARY KEY"' >> config/environment.rb | |
bash$ rake db:migrate:redo(in /Users/choonkeat/test/testbigint) | |
== CreateMessages: reverting ================================================= | |
-- drop_table(:messages) | |
-> 0.0828s | |
== CreateMessages: reverted (0.0829s) ======================================== | |
== CreateMessages: migrating ================================================= | |
-- create_table(:messages) | |
-> 0.0060s | |
== CreateMessages: migrated (0.0062s) ======================================== | |
bash$ ruby -rconfig/environment script/populate.rb | |
1 #<Message id: 1, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
3 #<Message id: 3, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
15 #<Message id: 15, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
255 #<Message id: 255, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
65535 #<Message id: 65535, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
4294967295 #<Message id: 4294967295, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
18446744073709551615 #<Message id: 18446744073709551615, content: nil, created_at: "2009-11-14 05:44:35", updated_at: "2009-11-14 05:44:35"> | |
bash$ mysql5 -u root testbigint | |
Welcome to the MySQL monitor. Commands end with ; or \g. | |
Your MySQL connection id is 171 | |
Server version: 5.0.85 Source distribution | |
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. | |
mysql> select max(id) from messages; | |
+----------------------+ | |
| max(id) | | |
+----------------------+ | |
| 18446744073709551615 | | |
+----------------------+ | |
1 row in set (0.00 sec) | |
mysql> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment