Forum: Ruby on Rails Help with tests/rake issues

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rafael S. (Guest)
on 2007-03-19 01:10
(Received via mailing list)
Hi All,

I have run into an odd issue in rails/tests (it might actually be a
bug). Unlike most rails apps, I have changed the id column in my
tables to be char(32). There are many reasons for this, so don't ask
;-)

Anyhow, my migrations work just fine and create the tables etc but I
have run into issues with testing. For some reason rake
db:test:prepare clones my dev db but switches all the id fields back
to int. I suspect that rake uses schema.rb to create the test database
and that would explain the wrong id type since the schema.rb produced
after each migration omits the id fields.

So, my migration looks like this:

create_table "activities", :id=>false, :force => true do |t|
  t.column :id, :string, :limit => 32, :null => false
  t.column "activity_name", :string,   :limit => 50
end

but once the migration runs the above table is represented in
schema.rb like this:

create_table "activities", :force => true do |t|
  t.column "activity_name", :string,   :limit => 50
end

(rake db:schema:dump also omits ids)

So it looks like the solution might be either:
1. Fix rake to dump correct schema
2. Make rake clone the dev db in some other way

Any ideas?

Thanks

Raf



--
http://www.bdcsoftware.com" - Automotive CRM
This topic is locked and can not be replied to.