Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kovyrin/db-charmer
ActiveRecord Connections Magic (slaves, multiple connections, sharding, etc)
https://github.com/kovyrin/db-charmer
Last synced: 3 months ago
JSON representation
ActiveRecord Connections Magic (slaves, multiple connections, sharding, etc)
- Host: GitHub
- URL: https://github.com/kovyrin/db-charmer
- Owner: kovyrin
- License: mit
- Archived: true
- Created: 2009-08-10T01:27:41.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2018-01-18T17:29:53.000Z (almost 7 years ago)
- Last Synced: 2024-07-07T20:06:54.456Z (4 months ago)
- Language: Ruby
- Homepage: http://kovyrin.github.io/db-charmer/
- Size: 668 KB
- Stars: 606
- Watchers: 35
- Forks: 116
- Open Issues: 19
-
Metadata Files:
- Readme: README.rdoc
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
= 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: http://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 http://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 http://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:- Group Info: http://groups.google.com/group/db-charmer
- Subscribe using the info page or by sending an email to mailto:[email protected]== 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: https://travis-ci.org/kovyrin/db-charmer
Build status is: {}[https://travis-ci.org/kovyrin/db-charmer]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:
- MySQLIn 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