ALTER TABLE `sites` ADD IF NOT EXISTS `loading_overlay` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `combine_css`;
UPDATE `sites` SET `loading_overlay`=0;
ALTER TABLE `sites` ADD IF NOT EXISTS `default_page_id` INT(11) UNSIGNED NULL DEFAULT NULL AFTER `template_id`;
ALTER TABLE `sites` ADD CONSTRAINT `sites_default_page_id` FOREIGN KEY (`default_page_id`) REFERENCES `pages` (`page_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
SELECT `page_id` FROM `pages` WHERE `url`='index' OR `url`='home' LIMIT 1 INTO @page_id;
UPDATE `sites` SET `default_page_id`=@page_id;
