Permalink
Browse files

move views to "every upgrade" file (#3885)

  • Loading branch information...
crossan007 authored and DawoudIO committed Jan 12, 2018
1 parent a9327fa commit 5dab03b90e8528724460198ba07209b22ac19d6e
@@ -89,6 +89,7 @@ public function restoreDatabaseFromBackup($file)
FileSystemUtils::recursiveRemoveDirectory($restoreResult->backupRoot,true);
$restoreResult->UpgradeStatus = UpgradeService::upgradeDatabaseVersion();
SQLUtils::sqlImport(SystemURLs::getDocumentRoot() . '/mysql/upgrade/rebuild_nav_menus.sql', $connection);
SQLUtils::sqlImport(SystemURLs::getDocumentRoot() . '/mysql/upgrade/rebuild_views.sql', $connection);
//When restoring a database, do NOT let the database continue to create remote backups.
//This can be very troublesome for users in a testing environment.
SystemConfig::setValue('bEnableExternalBackupTarget', '0');
@@ -53,6 +53,7 @@ static public function upgradeDatabaseVersion()
}
// always rebuild the menu
SQLUtils::sqlImport(SystemURLs::getDocumentRoot() . '/mysql/upgrade/rebuild_nav_menus.sql', $connection);
SQLUtils::sqlImport(SystemURLs::getDocumentRoot() . '/mysql/upgrade/rebuild_views.sql', $connection);
return true;
}
@@ -1,15 +1,2 @@
ALTER TABLE `events_event`
ADD COLUMN `event_publicly_visible` BOOLEAN DEFAULT FALSE AFTER `event_grpid`;
DROP VIEW IF EXISTS email_list;
CREATE VIEW email_list AS
SELECT fam_Email AS email, 'family' AS type, fam_id AS id FROM family_fam WHERE fam_email IS NOT NULL AND fam_email != ''
UNION
SELECT per_email AS email, 'person_home' AS type, per_id AS id FROM person_per WHERE per_email IS NOT NULL AND per_email != ''
UNION
SELECT per_WorkEmail AS email, 'person_work' AS type, per_id AS id FROM person_per WHERE per_WorkEmail IS NOT NULL AND per_WorkEmail != '';
DROP VIEW IF EXISTS email_count;
CREATE VIEW email_count AS
SELECT email, COUNT(*) AS total FROM email_list group by email;
ADD COLUMN `event_publicly_visible` BOOLEAN DEFAULT FALSE AFTER `event_grpid`;
@@ -0,0 +1,12 @@
DROP VIEW IF EXISTS email_list;
CREATE VIEW email_list AS
SELECT fam_Email AS email, 'family' AS type, fam_id AS id FROM family_fam WHERE fam_email IS NOT NULL AND fam_email != ''
UNION
SELECT per_email AS email, 'person_home' AS type, per_id AS id FROM person_per WHERE per_email IS NOT NULL AND per_email != ''
UNION
SELECT per_WorkEmail AS email, 'person_work' AS type, per_id AS id FROM person_per WHERE per_WorkEmail IS NOT NULL AND per_WorkEmail != '';
DROP VIEW IF EXISTS email_count;
CREATE VIEW email_count AS
SELECT email, COUNT(*) AS total FROM email_list group by email;

0 comments on commit 5dab03b

Please sign in to comment.