Download the PHP package iyogesharma/multi-db without Composer
On this page you can find all versions of the php package iyogesharma/multi-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package multi-db
MultiDB
What is this repository for?
- This Repo is created to make creating one main database and multiple client specific database easily.
-
It will automatically resolve db connection names using some properties defined in YS\MultiDB\Models\Model Class.
-
Model::$cachekey key to search client db name in cache. if set it will auto configure database connection based on this key value from cache. If not itn will connect to default database
-
Model::$cronKey Similar to $cacheKey you can set this key from crons jobs to automatically resolve database conection
- Version 1.0
How do I get set up?
- Installing
For PgSql
- instead of default Illuminate\Database\Migrations\Migration extend YS\MultiDB\Migration
- This class contains a static property called $schema which helps in identifying schema name for running migrations with dynamic schema names
For Example
- In your Models instead of default model class extend YS\MultiDB\Models\Model Class
- This class contains a static propert called $inMaindb with default value as false. You can set this value to true if your model belongs to main database not client specific database
To run client database/schema specific migration
- create a directory called newdatabase inside app directory
- you can customize name of this directory just publish config and update value of key new_migrations_path
- Place all the migration related to client specific database inside this folder
- Run
- Run to rollback migrations
- To create new migration inside app/newdatabase folder for client specific database use
- In order to run seeders for client specific database you can create seeders directory inside app/newdatabase folder and pass --seed option along with php artisan new:migrations command to run seeders inside this directory
- To run only seeders you can run
- to run a specific seeder inside this folder run
To Check How TO Create New DB Or Schema
Who do I talk to?
All versions of multi-db with dependencies
PHP Build Version
Package Version
The package iyogesharma/multi-db contains the following files
Loading the files please wait ...