Migrations with no ID

Hi there,
I’m using Migrations to define my db schema. However, I have a table
that mustn’t have an ID. Migrations always add them automatically; is
there any way to tell the “create_table” that I don¡t need the “id”
column?

Thanks.

create_table :images_tags, :id => false do |table|
table.column :image_id, :integer
table.column :tag_id, :integer
end

Damaris F. wrote:

Hi there,
I’m using Migrations to define my db schema. However, I have a table
that mustn’t have an ID. Migrations always add them automatically; is
there any way to tell the “create_table” that I don¡t need the “id”
column?

Thanks.

Nathan E. wrote:

create_table :images_tags, :id => false do |table|
table.column :image_id, :integer
table.column :tag_id, :integer
end

Thanks!!!
And, btw, what if I want an id but not of “integer” type?
Should I do something like
create_table :whatever, :id => false, :primary_key => my_id do |t|

table.column :my_id, :decimal

?

Thanks again.

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