![]() |
DBFORGE database creation catch-22 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: DBFORGE database creation catch-22 (/showthread.php?tid=53590) |
DBFORGE database creation catch-22 - El Forum - 07-30-2012 [eluser]WoolyG[/eluser] Hi all, Has anyone come across a dbforge create_database catch-22, or is there a way around the below? I'm looking to allow a user to set their own database name, and have the CI app automatically install the DB, and connect to it. Say I have a fresh CI install with the database library autoloaded, with the following settings: Code: $db['default']['hostname'] = 'localhost'; In dbforge, using $this->dbforge->create_database('db_name') is all fine & well, but the application/config/database.php needs to be manually updated also. I'm trying to keep away from manual file configuration on the part of the user as much as possible. Here's the catch-22: - If I use $this->dbforge->create_database() without updating database.php manually, I get a DB error requiring me to set a DB name. - If I manually set a DB name in database.php without first creating the database (manually), I get a DB error saying CI cannot select the named DB. Is there a way of using dbforge to create a DB, and have CI update its database.php to utilise the specified DB? All input appreciated. WoolyG |