Got stored procedures and views in your repo? Loading them should be simple.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
.gitignore
Gemfile
LICENSE
README.textile
Rakefile
dbuddy.gemspec

README.textile

DBuddy

Have stored procedures or view definitions in your application? Wouldn’t it be great if you could keep those with the rest of your code?

DBuddy is a small script that does two things to streamline this process:

  1. Loads all of the SQL files matching one or more globs
  2. Watches over those files and reloads them on changes

Usage

Loading:


  dbuddy db/views/*.sql db/procedures/*.sql

Watching:


  dbuddy --watch db/views/*.sql db/procedures/*.sql
  dbuddy -w db/views/*.sql db/procedures/*.sql

From code (e.g. rake task)


  DBuddy.run(ActiveRecord::Base.connection, Dir.glob("db/views/*.sql") + Dir.glob("db/procedures/*.sql"))

TODOs

  • Right now it assumes it’s being run in the root of a Rails project and loads config/environment.rb. This could be improved, but right now I don’t have a use case.