Coder Social home page Coder Social logo

db-charmer's Introduction

WARNING: The Project Has Been Suspended

Please note, that this project has been suspended. No updates will be provided and no Rails versions beyond 3.2.x will be supported. For more information please check out this blog post: kovyrin.net/2014/11/14/dbcharmer-suspended/

DB Charmer - ActiveRecord Connection Magic Plugin

DbCharmer is a simple yet powerful plugin for ActiveRecord that significantly extends its ability to work with multiple databases and/or database servers. The major features we add to ActiveRecord are:

  1. Simple management for AR model connections (switch_connection_to method)

  2. Switching of default AR model connections to separate servers/databases

  3. Ability to easily choose where your query should go (Model.on_* methods family)

  4. Automated master/slave queries routing (selects go to a slave, updates handled by the master).

  5. Multiple database migrations with very flexible query routing controls.

  6. Simple database sharding functionality with multiple sharding methods (value, range, mapping table).

For more information on the project, you can check out our web site at kovyrin.github.io/db-charmer/.

Installation

There are two options when approaching DbCharmer installation:

  • using the gem (recommended and the only way of using it with Rails 3.2+)

  • install as a Rails plugin (works in Rails 2.x only)

To install as a gem, add this to your Gemfile:

gem 'db-charmer', :require => 'db_charmer'

To install DbCharmer as a Rails plugin use the following command:

./script/plugin install git://github.com/kovyrin/db-charmer.git

Notice: If you use DbCharmer in a non-rails project, you may need to set DbCharmer.env to a correct value before using any of its connection management methods. Correct value here is a valid database.yml first-level section name.

Documentation/Questions

For more information about the library, please visit our site at dbcharmer.net. If you need more defails on DbCharmer internals, please check out the source code. All the plugin’s code is ~100% covered with tests. The project located in test-project directory has unit tests for all or, at least, the most actively used code paths.

If you have any questions regarding this project, you could contact the author using the DbCharmer Users Group mailing list:

What Ruby and Rails implementations does it work for?

We have a continuous integration setup for this gem on with Rails 2.3, 3.0, 3.1 and 3.2 using a few different versions of Ruby.

CI is running on TravisCI.org: travis-ci.org/kovyrin/db-charmer Build status is: <img src=“https://secure.travis-ci.org/kovyrin/db-charmer.png?branch=master” alt=“Build Status: Rails 3.x” />

At the moment we have the following build matrix:

  • Rails versions:

    • 2.3

    • 3.0

    • 3.1

    • 3.2

  • Ruby versions:

    • 1.8.7

    • 1.9.3 (Rails 3.0+ only)

    • 2.0.0 (Rails 3.2+ only)

  • Databases:

    • MySQL

In addition to CI testing, this gem is used in production on Scribd.com (one of the largest RoR sites in the world) with Ruby Enterprise Edition and Rails 2.2, Rails 2.3, Sinatra and plain Rack applications.

Starting with version 1.8.0 we support Rails versions 3.2.8 and higher. Please note, that Rails 3.2.4 is not officially supported. Your code may work on that version, but no bug reports will be accepted about this version.

Is it Thread-Safe?

Starting with version 1.9.0 we have started working on making the code thread-safe and making sure DbCharmer works correctly in multi-threaded environments. At this moment we consider multi-threaded mode experimental. If you use it and it works for you - please let us know, if it does not - please make sure to file a ticket so that we could improve the code and make it work in your situation.

Who are the authors?

This plugin has been created in Scribd.com for our internal use and then the sources were opened for other people to use. Most of the code in this package has been developed by Oleksiy Kovyrin for Scribd.com and is released under the MIT license. For more details, see the LICENSE file.

Other contributors who have helped with the development of this library are (alphabetically ordered):

  • Allen Madsen

  • Andrew Geweke

  • Ashley Martens

  • Cauê Guerra

  • David Dai

  • Dmytro Shteflyuk

  • Eric Lindvall

  • Eugene Pimenov

  • Jonathan Viney

  • Gregory Man

  • Michael Birk

  • Tyler McMullen

db-charmer's People

Contributors

ageweke avatar arthurnn avatar ashleym1972 avatar blatyo avatar caueguerra avatar eric avatar gregory-m avatar jviney avatar kovyrin avatar kpumuk avatar libc avatar ngan avatar watsonbox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.