# Create string primairy key

**URL:** <https://www.ruby-forum.com/t/create-string-primairy-key/116430>\
**Category:** Rails\
**Created:** [October 5, 2007, 12:13pm UTC](https://www.ruby-forum.com/t/create-string-primairy-key/116430 "2007-10-05T12:13:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [October 5, 2007, 12:13pm UTC](https://www.ruby-forum.com/t/create-string-primairy-key/116430/1 "2007-10-05T12:13:23Z")

</div>

Hi all,

I have 2 questions:  
1-  
I try to make a primairy key that’s a string (tuis not the default  
int). I use:  
t.column “id”, :string, {:limit =\> 30, :null =\>  
false, :auto\_increment =\> false}

When migrating this gives an error (very generic one). Can someone  
lease explain the problem with that line?

2-  
When I have a many-to-many (users-groups) relationship I have a  
coupling table groupsusers that contain the id of the group and user.  
is it normal that you give these 2 colums an unique key?

Many thanks  
Stijn
