There are two important methods to keep in mind when working with multiple databases. To add a new database connection use R::addDatabase()
To select a database, use the key you have previously specified:
If you used R::setup() to connect to your database you can switch back to this database using:
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:
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.
As of version 3.4 this function is no longer included in the default distribution.
RedBeanPHP Easy ORM for PHP © 2013 Gabor de Mooij and the RedBeanPHP community - Licensed New BSD/GPLv2