scripts/upgrade.php would fail if Profile_prefs did not exist

A checkschema.php run would've done it, but that would require an
additional step to our upgrade procedure.
This commit is contained in:
Mikael Nordfeldth 2014-11-27 14:46:10 +01:00
parent 411ce0629c
commit 1b449ea705
1 changed files with 4 additions and 0 deletions

View File

@ -59,6 +59,10 @@ class FavoritePlugin extends ActivityHandlerPlugin
$user->whereAdd('emailnotifyfav IS NOT NULL');
if ($user->find()) {
printfnq("Detected old User table (emailnotifyfav IS NOT NULL). Moving 'emailnotifyfav' property to Profile_prefs...");
// First we'll make sure Profile_prefs exists
$schema = Schema::get();
$schema->ensureTable('profile_prefs', Profile_prefs::schemaDef());
// Make sure we have our own tables setup properly
while ($user->fetch()) {
$user->setPref('email', 'notify_fave', $user->emailnotifyfav);