Blankman
Blankman

Reputation: 266978

Can I create a table without a primary key?

I want to create a table without a primar key:

users_models

user_id model_id

I have a users table, but the model_id value is actually going to come from a enumeration that I have in my code.

So I don't need a primary key on this table, can I in my migration tell it so it doesn't create one?

Upvotes: 1

Views: 223

Answers (1)

Spyros
Spyros

Reputation: 48626

At your migration change :

 create_table :users, {:id => false, :force => true}

Upvotes: 2

Related Questions