added database versioning

This commit is contained in:
following
2013-04-22 20:21:06 +02:00
parent da12a3e4a7
commit a6547619e3
4 changed files with 122 additions and 8 deletions
+8 -3
View File
@@ -12,11 +12,16 @@
* Tables must be updated manually, see htdocs/doc/sql/db-changes.txt
*/
$rootpath = dirname(__FILE__) . '/../htdocs/';
require($rootpath . 'lib/settings.inc.php');
$rootpath = $opt['rootpath'] = dirname(__FILE__) . '/../htdocs/';
chdir($rootpath);
require_once('lib2/cli.inc.php');
echo "importing data.sql ...\n";
system('cat ' . $rootpath . 'doc/sql/static-data/data.sql | mysql -h' . $dbserver . ' -u' . $dbusername . ' --password=' . $dbpasswd . ' ' . $dbname);
system('cat ' . $rootpath . 'doc/sql/static-data/data.sql |' .
' mysql -h' . $opt['db']['servername'] . ' -u' . $opt['db']['username'] . ' --password=' . $opt['db']['password'] . ' ' . $opt['db']['placeholder']['db']);
echo "updating db structure ...\n";
require('dbsv-update.php');
echo "importing triggers ...\n";
chdir ($rootpath . 'doc/sql/stored-proc');