1
1
Fork 0

Changed order

This commit is contained in:
Michael 2020-11-17 23:45:16 +00:00
parent 3fe7d035d4
commit 317921e51c
2 changed files with 23 additions and 22 deletions

View 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`

View 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>" => [