Skip to content

AndrewO/dbuddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Got stored procedures and views in your repo? Loading them should be simple.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages