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__));
16 BaseObject::setApp($a);
18 @include ".htconfig.php";
19 dba::connect($db_host, $db_user, $db_pass, $db_data);
20 unset($db_host, $db_user, $db_pass, $db_data);
22 if ($_SERVER["argc"] == 2) {
23 switch ($_SERVER["argv"][1]) {
25 DBStructure::update(true, false);
28 DBStructure::update(true, true);
30 $build = Config::get('system','build');
32 Config::set('system', 'build', DB_UPDATE_VERSION);
33 $build = DB_UPDATE_VERSION;
36 $stored = intval($build);
37 $current = intval(DB_UPDATE_VERSION);
39 // run any left update_nnnn functions in update.php
40 for ($x = $stored; $x < $current; $x ++) {
41 $r = run_update_function($x);
47 Config::set('system','build',DB_UPDATE_VERSION);
50 DBStructure::printStructure();
53 DBStructure::convertToInnoDB();
59 echo $_SERVER["argv"][0]." <command>\n";
62 echo "dryrun show database update schema queries without running them\n";
63 echo "update update database schema\n";
64 echo "dumpsql dump database schema\n";
65 echo "toinnodb convert all tables from MyISAM to InnoDB\n";