• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Workflow question: Reconciling database local <-> remote

#2
[eluser]Colin Williams[/eluser]
The database synchronization would likely happen with a completely different process. CI, or even PHP for that matter, is not the best tool for that

+ + + + + + + + + + ++ + + + + + + + + + + + + +

The database library was specifically designed for part of your situation. If you look at the config file, you can setup multiple DB configurations. Obviously you'll have a dev configuration and a local configuration. Then, in the db config or elsewhere, use a conditional to select the approprate db configuration as the active one.

If you name your configurations by IP, you can set $active_group to the current server IP, and it works rather elegantly:

Code:
$active_group = $_SERVER['SERVER_ADDR'];

$db['127.0.0.1']['hostname'] = 'localhost';
//... etc

$db['65.72.2.112']['hostname'] = 'localhost';
//... etc

Another tip to reduce code is to copy one config and only set values that need changing

Code:
$db['65.72.2.112'] = $db['127.0.0.1']
$db['65.72.2.112']['username'] = 'db8703_admin';
$db['65.72.2.112']['password'] = 'suP3rs3cReT';


Messages In This Thread
Workflow question: Reconciling database local <-> remote - by El Forum - 08-30-2008, 03:19 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.