3 * @file scripts/dbstructure.php
4 * @brief Does database updates from the command line
7 require_once 'include/dbstructure.php';
10 use Friendica\Core\Config;
12 $a = new App(dirname(__DIR__));
14 @include ".htconfig.php";
15 require_once "include/dba.php";
16 dba::connect($db_host, $db_user, $db_pass, $db_data);
17 unset($db_host, $db_user, $db_pass, $db_data);
19 if ($_SERVER["argc"] == 2) {
20 switch ($_SERVER["argv"][1]) {
22 update_structure(true, false);
25 update_structure(true, true);
27 $build = Config::get('system','build');
29 Config::set('system', 'build', DB_UPDATE_VERSION);
30 $build = DB_UPDATE_VERSION;
33 $stored = intval($build);
34 $current = intval(DB_UPDATE_VERSION);
36 // run any left update_nnnn functions in update.php
37 for ($x = $stored; $x < $current; $x ++) {
38 $r = run_update_function($x);
44 Config::set('system','build',DB_UPDATE_VERSION);
47 print_structure(db_definition());
56 echo $_SERVER["argv"][0]." <command>\n";
59 echo "dryrun show database update schema queries without running them\n";
60 echo "update update database schema\n";
61 echo "dumpsql dump database schema\n";
62 echo "toinnodb convert all tables from MyISAM to InnoDB\n";