I would like to use postgresql with foreign keys to define relationships in data so that other platforms/apps would also be able to easily use the same database. Having some kind of ruby DSL to define database schema with migration support would also be great. Which framework would you recommend for me?
Is there some kind of framework for only handling database schema changes, migrations and versions separate of ORM?
Check out DataMapper. I recently used it with Sinatra and deployed the app to Heroku. The only SQL I had to write was CREATE DATABASE. Everything else DataMapper provided for me with the .auto_migrate! and .auto_upgrade! functionality.
The foreign key support is in the dm-constraints plugin.
Between ActiveRecord and DataMapper I'd chose the latter. Both use the Active Record pattern, so you'll actually get your database tables back in objects without fancy domain logic, but DataMapper is way easier to work with, and is thread-safe. There is also Sequel, but which I'm not familiar with.
If you need a framework to handle migrations I'd advise merb. Althoug it's a complete web framework starting 1.1 it can handle migrations for the three previously mentioned ORM framework (including separate and auto migrations)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With