Can anyone recommend a database modelling tool for the Mac? I'm
building a new Rails app and want an interface to draw out the
database's entity relationship diagram, setup foreign keys and then
output DDL at the end to MySQL.
I've previously used DBDesigner, CASE Studio and some pricier
enterprise software on Windows, but can't find anything suitable for
my Mac. The MySQL Workbench project seems to have stalled and I can't
find anything suitable.
If you are happy with just creating diagrams and then using Rails migrations to create your database scheme (from my point of view the best thing to do anyway), you could use Omnigraffle.
Using ActiveRecord with extra database level stuff like foreign key
constraints, multiple-column primary keys, etc. is the Wrong Thing to
do. I got burned by this and had to re-write my database schema in
Rails 1.1.6. ActiveRecord will enforce most of that stuff for you if
you tell it to.
Most of these tools will probably generate schemas that have that
extra cruft. They'll also probably not be compatible with migrations.
Multiple-column primary keys does not seem compatible with
ActiveRecord as you say.
However, I disagree about not using foreign key constraints. These are
wonderful, useful aids to maintain the referential integrity of the
DB. When your code violates one, you get a SQL error immediately. It's
much easier to fix one of these than it is to try to debug an
application that fails intermitently due to data error.
Personally, I have been doing relational database work since the 80's,
so I perfer to use dbms tools over rails migrations. Take what works
and leave the rest when it comes to frameworks and development tools.
Whatever happened to that AJAX one which was specifically designed for rails? ie, it would generate rails migrations and stuff. Someone posted a link to it here a while ago (although searching my mail archives, I can’t find it). That looked promising, even though it was in some kind of pre-alpha stage.
I agree, they are a great help to get a chain of has_many :dependent right. You get an index for that column automatically as well at least in MySQL and a few more, so we use the plugin from RedHill Consulting in all our applications.