Another foreign key added
This commit is contained in:
parent
9113b7e393
commit
88eee2b9c1
3 changed files with 7 additions and 3 deletions
|
@ -57,9 +57,9 @@ class RepairDatabase
|
|||
// Add intro entries for pending contacts
|
||||
// We don't do this for DFRN entries since such revived contact requests seem to mostly fail.
|
||||
$pending_contacts = DBA::p("SELECT `uid`, `id`, `url`, `network`, `created` FROM `contact`
|
||||
WHERE `pending` AND `rel` IN (?, ?) AND `network` != ?
|
||||
WHERE `pending` AND `rel` IN (?, ?) AND `network` != ? AND `uid` != ?
|
||||
AND NOT EXISTS (SELECT `id` FROM `intro` WHERE `contact-id` = `contact`.`id`)",
|
||||
0, Contact::FOLLOWER, Protocol::DFRN);
|
||||
0, Contact::FOLLOWER, Protocol::DFRN, 0);
|
||||
while ($contact = DBA::fetch($pending_contacts)) {
|
||||
DBA::insert('intro', ['uid' => $contact['uid'], 'contact-id' => $contact['id'], 'blocked' => false,
|
||||
'hash' => Strings::getRandomHex(), 'datetime' => $contact['created']]);
|
||||
|
|
|
@ -671,7 +671,7 @@ return [
|
|||
"comment" => "",
|
||||
"fields" => [
|
||||
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
|
||||
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
|
||||
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
|
||||
"fid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
|
||||
"contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
|
||||
"knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
||||
|
|
|
@ -614,6 +614,10 @@ function pre_update_1364()
|
|||
return Update::FAILED;
|
||||
}
|
||||
|
||||
if (!DBA::e("DELETE FROM `intro` WHERE NOT `uid` IN (SELECT `uid` FROM `user`)")) {
|
||||
return Update::FAILED;
|
||||
}
|
||||
|
||||
if (!DBA::e("DELETE FROM `manage` WHERE NOT `uid` IN (SELECT `uid` FROM `user`)")) {
|
||||
return Update::FAILED;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue