# String ID -\> schema.rb incorrect?

**URL:** <https://www.ruby-forum.com/t/string-id-schema-rb-incorrect/161699>\
**Category:** Rails\
**Created:** [March 1, 2009, 11:27am UTC](https://www.ruby-forum.com/t/string-id-schema-rb-incorrect/161699 "2009-03-01T11:27:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Vielsmaier](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@Martin\_Vielsmaier](https://www.ruby-forum.com/u/Martin_Vielsmaier)\
**Post date:** [March 1, 2009, 11:27am UTC](https://www.ruby-forum.com/t/string-id-schema-rb-incorrect/161699/1 "2009-03-01T11:27:42Z")

</div>

Hi,

I made one of my ID columns a string, because I don’t want my IDs to  
be guessable (I use a md5 hash of some system parameters with  
rehashing in case of collisions.)

My migration reads:  
…  
change\_column :users, :id, :string  
change\_column :comments, :user\_id, :string

Afterwards executing this my db/schema.rb looks like this:  
…  
create\_table “comments”, :force =\> true do |t|  
t.integer “commentable\_id”  
t.string “commentable\_type”  
t.string “user\_id”  
t.datetime “date”  
t.text “body”  
end  
#so far so good  
…  
create\_table “users”, :force =\> true do |t|  
t.string “email”  
t.string “pwd\_hash”  
t.boolean “is\_active”  
t.datetime “last\_activity”  
t.string “pwd\_salt”  
t.string “activation\_key”  
t.datetime “signup\_date”  
end

hmm, I consider it a bug, because running the migrations and loading  
the schema from schema.rb lead to different schemas.  
What do you think?
