# Migrations with no ID

**URL:** <https://www.ruby-forum.com/t/migrations-with-no-id/123159>\
**Category:** Rails\
**Created:** [December 14, 2007, 2:49pm UTC](https://www.ruby-forum.com/t/migrations-with-no-id/123159 "2007-12-14T14:49:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [December 14, 2007, 2:49pm UTC](https://www.ruby-forum.com/t/migrations-with-no-id/123159/1 "2007-12-14T14:49:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [December 14, 2007, 2:55pm UTC](https://www.ruby-forum.com/t/migrations-with-no-id/123159/2 "2007-12-14T14:55:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [December 14, 2007, 2:59pm UTC](https://www.ruby-forum.com/t/migrations-with-no-id/123159/3 "2007-12-14T14:59:06Z")

</div>

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.
