Repository is archived
No commit activity in last 3 years
No release in over 3 years
Generate new config datanbase and add this connect to current project
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0
 Project Readme

Gem Version

MultiTenancyDatabase

Allowing multiple databases to connect to the same project and still use ActiveRecord to perform operations on the models

Installation

Add this line to your application's Gemfile:

gem 'multi_tenancy_database'

And then execute:

$ bundle

Or install it yourself as:

$ gem install multi_tenancy_database

Usage

In this example, we’ll have a separate database for our e-commerce school that we’ll call school.

Add new database

multi_tenancy_database -n school -a postgresql

Create Database

rails school:db:create

Create new model

rails g school_model user first_name:string last_name:string

Add more field to model user

rails g school_migration AddPhoneFieldToUser phone:string

Migrate

rails school:db:migrate