
There are two important methods to keep in mind when working with multiple databases. To add a new database connection use R::addDatabase()
R::addDatabase('DB1','sqlite:/tmp/d1.sqlite',
'user','password',$frozen);
To select a database, use the key you have previously specified:
R::selectDatabase('DB1');
If you used R::setup() to connect to your database you can switch back to this database using:
R::selectDatabase('default');
From RedBeanPHP 3.3 on you can sync two database schemas (always make sure you have a backup before executing this function!). This allows you to quickly write your own deployment tools for RedBeanPHP. Usage:
R::syncSchema('source','destination');
Here RedBeanPHP will sync the database under key "destination" to match the schema of database under key "source". The sync function will apply so-called pessimistic syncing, it will add some columns and tables but it will not remove tables or columns. An interesting bonus is that this function can sync across different database platforms, for instance from PostgreSQL to MySQL etc.
RedBeanPHP Easy ORM for PHP © 2013 Gabor de Mooij and the RedBeanPHP community - Licensed New BSD/GPLv2