bellycard / napa

A simple framework for building APIs with Grape
Other
329 stars 72 forks source link

Port db rake tasks from Rails #191

Open shaqq opened 9 years ago

shaqq commented 9 years ago

@bellycard/platform @darbyfrey

so far, the current database rake tasks we have get us by pretty far:

https://github.com/bellycard/napa/blob/master/lib/tasks/db.rake

but there are other niceties in ActiveRecord that we're not leveraging (such as migrating up/down a version):

https://github.com/rails/rails/blob/e46202139647b458b8c3d5eb3a0dff29474159d3/activerecord/lib/active_record/railties/databases.rake

I'm not quite sure loading the databases.rake file would be a quick and dirty solution because there's still some Rails-specific stuff there.

There also might be other rake tasks that we could use.

ianneub commented 9 years ago

This might also fix an issue I'm having where none of the rake db:* tasks work because my DB server is not on localhost.

https://github.com/bellycard/napa/blob/master/lib/tasks/db.rake#L27

The options hash never gets the host, username, password, or database options from the database.yml.

ianneub commented 9 years ago

I made a quick patch to fix the issue I saw. #202