Auto increment a non-primary key field in Ruby on Rails?

You need to execute an SQL statement statement = "ALTER TABLE users CHANGE id id SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT" ActiveRecord::Base.connection. Execute(statement) you can entry manually in your migration Note this is just an example. The final SQL statement syntax depends on the database.

You need to execute an SQL statement. Statement = "ALTER TABLE users CHANGE id id SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT" ActiveRecord::Base.connection. Execute(statement) you can entry manually in your migration Note this is just an example.

The final SQL statement syntax depends on the database.

I would expect something like: t. Integer :auto_i, :auto_increment => true to work (but it does not). – kingjeffrey Jul 10 '10 at 19:41 1 yes Rails does not provide :auto_increment keyword in migrations – user386660 Jul 10 '10 at 22:29 And if you want to all keywords or other good things in Rails then .

" rubymine IDE for ROR " would be so useful. I am using for last 6 months. – user386660 Jul 10 '10 at 22:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions