GithubHelp home page GithubHelp logo

databranch's Introduction

Databranch

Databranch implements database branching in development and test by cloning the database automatically, supplementing Git branching workflow. This prevents situations where the database becomes stale due to schema or data inconsistencies between git branches. It automates the process of creating and deleting branch database copies by hooking into git.

Installation

Add this line to your application's Gemfile:

gem 'databranch'

And then execute:

$ bundle

Run the databranch install rake task to install the initializer and git hooks:

$ rake databranch:install

Finally, update your database.yml file to point your development and test databases to databranch environment variables:

development:
  <<: *default
  database: <%= ENV['DATABRANCH_DEVELOPMENT'] %>

test:
  <<: *default
  database: <%= ENV['DATABRANCH_TEST'] %>

Note: Databranch currently only works with Rails and PostgreSQL. It's developed for Rails 5 but will probably work with some older versions as well (untested).

Usage

Databranch does the rest for you. When you checkout a new branch it will automatically copy the schema and data of the database corresponding to your existing branch to a new database that corresponds to the newly created branch for development and test.

When you git commit, databranch checks to find databases that correspond to deleted branches and asks you if you'd like to delete them.

TODO

Add tests.

Persist user preferences regarding specific database deletion. Perhaps add them to a file (investigate using PStore), then when running the post commit hook check to see whether or not the database itself has been deleted. If it has, remove the name.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/GuruKhalsa/databranch.

License

The gem is available as open source under the terms of the MIT License.

databranch's People

Contributors

gurukhalsa avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.