4 * @file scripts/dbstructure.php
5 * @brief Does database updates from the command line
8 require_once 'include/dbstructure.php';
11 use Friendica\Core\Config;
13 $a = new App(dirname(__DIR__));
15 @include ".htconfig.php";
16 require_once "include/dba.php";
17 dba::connect($db_host, $db_user, $db_pass, $db_data);
18 unset($db_host, $db_user, $db_pass, $db_data);
20 if ($_SERVER["argc"] == 2) {
21 switch ($_SERVER["argv"][1]) {
23 update_structure(true, false);
26 update_structure(true, true);
28 $build = Config::get('system','build');
30 Config::set('system', 'build', DB_UPDATE_VERSION);
31 $build = DB_UPDATE_VERSION;
34 $stored = intval($build);
35 $current = intval(DB_UPDATE_VERSION);
37 // run any left update_nnnn functions in update.php
38 for ($x = $stored; $x < $current; $x ++) {
39 $r = run_update_function($x);
45 Config::set('system','build',DB_UPDATE_VERSION);
48 print_structure(db_definition());
57 echo $_SERVER["argv"][0]." <command>\n";
60 echo "dryrun show database update schema queries without running them\n";
61 echo "update update database schema\n";
62 echo "dumpsql dump database schema\n";
63 echo "toinnodb convert all tables from MyISAM to InnoDB\n";