3 * @file scripts/dbstructure.php
4 * @brief Does database updates from the command line
7 require_once 'include/dbstructure.php';
11 $a = new App(dirname(__DIR__));
13 @include ".htconfig.php";
14 require_once "include/dba.php";
15 dba::connect($db_host, $db_user, $db_pass, $db_data);
16 unset($db_host, $db_user, $db_pass, $db_data);
18 if ($_SERVER["argc"] == 2) {
19 switch ($_SERVER["argv"][1]) {
21 update_structure(true, false);
24 update_structure(true, true);
26 $build = Config::get('system','build');
28 Config::set('system', 'build', DB_UPDATE_VERSION);
29 $build = DB_UPDATE_VERSION;
32 $stored = intval($build);
33 $current = intval(DB_UPDATE_VERSION);
35 // run any left update_nnnn functions in update.php
36 for ($x = $stored; $x < $current; $x ++) {
37 $r = run_update_function($x);
43 Config::set('system','build',DB_UPDATE_VERSION);
46 print_structure(db_definition());
55 echo $_SERVER["argv"][0]." <command>\n";
58 echo "dryrun show database update schema queries without running them\n";
59 echo "update update database schema\n";
60 echo "dumpsql dump database schema\n";
61 echo "toinnodb convert all tables from MyISAM to InnoDB\n";