Id field without autoincrement option in migraion

Hi everybody,

I want to create a table using the rails migration, in which I want to
disable the auto increment option option for the id field. Is there any
way. I know we can avoid the id field as :id => false in migration file.

But I want the id field without auto increment property.

Regards,
Veeraa.T

Veera S. wrote:

Hi everybody,

I want to create a table using the rails migration, in which I want to
disable the auto increment option option for the id field. Is there any
way. I know we can avoid the id field as :id => false in migration file.

But I want the id field without auto increment property.

Regards,
Veeraa.T

any body is there…

just i want to create a table where id dont have auto increment property
using rails migration file (/db/migrate)…

create_table :users do |t|
t.column “id”, :integer, :auto_increment => false
end

is it possible. Any comments are welcome.

Thanks with regards,
Veerasundaravel.T

Well i think if you are using LAMR or WAMR then you can directly go to
the db and choose the table for edit then u will find that under extra
there will be the auto increment option just remove that and it will
work

hope this helps

Dhaval P. wrote:

Well i think if you are using LAMR or WAMR then you can directly go to
the db and choose the table for edit then u will find that under extra
there will be the auto increment option just remove that and it will
work

hope this helps

Sure Dhaval P…

I know about this by phpmyadmin or by ordinary mysql queries. But I want
to do this by Rails migration file. Is it possible.

Regards,
Veeraa.T

Hi,I have the same problem,did you resolved it?

On Aug 24 2007, 7:21 pm, Veera S. <rails-mailing-l…@andreas-

Running:
change_column :table_name, :id, :integer

will remove auto_increment but leave id as the primary key.
Unfortunately the change is not reflected in db/schema so recreating
the db through ‘rake db:schema:load’ will put auto_increment on the
table. Creating the db through ‘rake db:migrate’ will achieve your
desired result. The auto_increment option is hard coded into the
mysql_adapter so there doesn’t appear to be any way to explicitly pass
this through as a column option.

Sam Goldstein

On Aug 24 2007, 4:21 am, Veera S. <rails-mailing-l…@andreas-

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs