]> git.mxchange.org Git - friendica.git/commitdiff
Changed order
authorMichael <heluecht@pirati.ca>
Tue, 17 Nov 2020 23:45:16 +0000 (23:45 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 17 Nov 2020 23:45:16 +0000 (23:45 +0000)
src/Database/DBStructure.php
static/dbstructure.config.php

index 5d0749c58308274baa10fef633cfb864e98b3ffd..a59376e0ca5a288a3c3ff621b18ad09ef414faa8 100644 (file)
@@ -1054,6 +1054,28 @@ class DBStructure
                        }
                }
 
+               if (self::existsTable('user') && !DBA::exists('user', ['uid' => 0])) {
+                       $system = User::getSystemAccount();
+                       $user = [
+                               "username" => $system['name'],
+                               "nickname" => $system['nick'],
+                               "register_date" => $system['created'],
+                               "pubkey" => $system['pubkey'],
+                               "prvkey" => $system['prvkey'],
+                               "spubkey" => $system['spubkey'],
+                               "sprvkey" => $system['sprvkey'],
+                               "verified" => true,
+                               "page-flags" => User::PAGE_FLAGS_SOAPBOX,
+                               "account-type" => User::ACCOUNT_TYPE_RELAY,
+                       ];
+       
+                       DBA::insert('user', $user);
+                       $lastid = DBA::lastInsertId();
+                       if ($lastid != 0) {
+                               DBA::update('user', ['uid' => 0], ['uid' => $lastid]);
+                       }
+               }
+
                if (self::existsTable('contact') && !DBA::exists('contact', ['id' => 0])) {
                        DBA::insert('contact', ['nurl' => '']);
                        $lastid = DBA::lastInsertId();
@@ -1101,28 +1123,6 @@ class DBStructure
                        }
                }
 
-               if (self::existsTable('user') && !DBA::exists('user', ['uid' => 0])) {
-                       $system = User::getSystemAccount();
-                       $user = [
-                               "username" => $system['name'],
-                               "nickname" => $system['nick'],
-                               "register_date" => $system['created'],
-                               "pubkey" => $system['pubkey'],
-                               "prvkey" => $system['prvkey'],
-                               "spubkey" => $system['spubkey'],
-                               "sprvkey" => $system['sprvkey'],
-                               "verified" => true,
-                               "page-flags" => User::PAGE_FLAGS_SOAPBOX,
-                               "account-type" => User::ACCOUNT_TYPE_RELAY,
-                       ];
-       
-                       DBA::insert('user', $user);
-                       $lastid = DBA::lastInsertId();
-                       if ($lastid != 0) {
-                               DBA::update('user', ['uid' => 0], ['uid' => $lastid]);
-                       }
-               }
-
                if (!self::existsForeignKeyForField('tokens', 'client_id')) {
                        $tokens = DBA::p("SELECT `tokens`.`id` FROM `tokens`
                                LEFT JOIN `clients` ON `clients`.`client_id` = `tokens`.`client_id`
index 65d7ce7817797e7139bb431134886b32f50b5fa8..cabb48c58f2c61bba8aeefaa26bdcb222e8121bb 100644 (file)
@@ -20,6 +20,7 @@
  * Main database structure configuration file.
  *
  * Here are described all the tables, fields and indexes Friendica needs to work.
+ * The entry order is mostly alphabetic - with the exception of tables that are used in foreign keys.
  *
  * Syntax (braces indicate optionale values):
  * "<table name>" => [