4 * @file scripts/dbstructure.php
5 * @brief Does database updates from the command line
9 use Friendica\Core\Config;
10 use Friendica\Database\DBStructure;
12 require_once "boot.php";
13 require_once "include/dba.php";
15 $a = new App(dirname(__DIR__));
17 @include ".htconfig.php";
18 dba::connect($db_host, $db_user, $db_pass, $db_data);
19 unset($db_host, $db_user, $db_pass, $db_data);
21 if ($_SERVER["argc"] == 2) {
22 switch ($_SERVER["argv"][1]) {
24 DBStructure::update(true, false);
27 DBStructure::update(true, true);
29 $build = Config::get('system','build');
31 Config::set('system', 'build', DB_UPDATE_VERSION);
32 $build = DB_UPDATE_VERSION;
35 $stored = intval($build);
36 $current = intval(DB_UPDATE_VERSION);
38 // run any left update_nnnn functions in update.php
39 for ($x = $stored; $x < $current; $x ++) {
40 $r = run_update_function($x);
46 Config::set('system','build',DB_UPDATE_VERSION);
49 DBStructure::printStructure();
52 DBStructure::convertToInnoDB();
58 echo $_SERVER["argv"][0]." <command>\n";
61 echo "dryrun show database update schema queries without running them\n";
62 echo "update update database schema\n";
63 echo "dumpsql dump database schema\n";
64 echo "toinnodb convert all tables from MyISAM to InnoDB\n";