Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which ruby ORM framework to use in a standalone ruby app? [closed]

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?

like image 203
JtR Avatar asked Jun 16 '09 11:06

JtR


2 Answers

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.

like image 109
Jonas Elfström Avatar answered Sep 24 '22 09:09

Jonas Elfström


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)

like image 43
SztupY Avatar answered Sep 21 '22 09:09

SztupY