Forum: Ruby on Rails Rails generates incomplete schema

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.
blgroup (Guest)
on 2009-04-29 02:38
(Received via mailing list)
Is it possible to get the generated schema.rb to include accurately
reflect your database's schema?

For example, when using usesguid plugin, we change the primary key
from id, int(11), autoincrement to say, guid, varchar(22)

The schema file picks up the change of id to guid, but not the type.
So when the test DB is created from schema.rb, the guid column is int
(11) autoincrement.  This causes havoc with unit tests and does not
accurately depict the production environment.

How do people deal with this?  It's driving me crazy.

Similarly, adding a new column as integer autoincrement that is not
the primary key is also not reflected in schema.rb and completely
breaks fixtures.

Any help would be appreciated,

Thanks,
=Blair.
blgroup (Guest)
on 2009-04-29 23:17
(Received via mailing list)
Apparently config.active_record.schema_format = :sql in environment.rb
was the trick I was looking for.

Not very obvious.  Not obvious that your test DB schema will be
different than your dev/prod schema should you start putting weird
stuff in your migrations.

=Blair.
This topic is locked and can not be replied to.