1
0
Fork 0

Add post-update migration routine for custom profiles

This commit is contained in:
Hypolite Petovan 2020-01-19 09:43:59 -05:00
commit d9f7556b4a
2 changed files with 91 additions and 0 deletions

View file

@ -430,3 +430,18 @@ function update_1330()
return Update::SUCCESS;
}
function update_1332()
{
$condition = ["`is-default` IS NOT NULL"];
$profiles = DBA::select('profile', [], $condition);
while ($profile = DBA::fetch($profiles)) {
DI::profileField()->migrateFromProfile($profile);
}
DBA::close($profiles);
DBA::update('contact', ['profile-id' => null], ['`profile-id` IS NOT NULL']);
return Update::SUCCESS;
}