New foreign key for the "photo" table

This commit is contained in:
Michael 2020-08-21 18:37:58 +00:00
parent 61a2b225bb
commit cbdaf6298a
3 changed files with 12 additions and 4 deletions

View file

@ -49,6 +49,7 @@ use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Model\Storage;
use Friendica\Util\DateTimeFormat;
@ -571,3 +572,9 @@ function pre_update_1358()
return Update::SUCCESS;
}
function pre_update_1363()
{
Photo::delete(["`contact-id` != ? AND NOT `contact-id` IN (SELECT `id` FROM `contact`)", 0]);
return Update::SUCCESS;
}