diff --git a/cosmogramme/sql/patch/patch_265.php b/cosmogramme/sql/patch/patch_265.php index f12163ced40cc4087c3f2e755a549fef8dc7e012..b24d8022d077e6228ca45cee1ebb4d938484f0a9 100644 --- a/cosmogramme/sql/patch/patch_265.php +++ b/cosmogramme/sql/patch/patch_265.php @@ -1,4 +1,14 @@ <?php $adapter = Zend_Db_Table::getDefaultAdapter(); -$adapter->query('ALTER TABLE `album` MODIFY `notice_id` int(11) null default null'); -$adapter->query('UPDATE `album` SET `notice_id`=null WHERE `notice_id`=0'); \ No newline at end of file +foreach([['table' => 'album', 'id' => 'notice_id'], + ['table' => 'cms_article', 'id' => 'id_notice'], + ['table' => 'rss_flux', 'id' => 'id_notice'], + ['table' => 'sito_url', 'id' => 'id_notice']] + as $params) { + + $adapter->query(sprinf('ALTER TABLE `%s` MODIFY `%s` int(11) null default null', + $params['table'], $params['id'])); + + $adapter->query(sprintf('UPDATE `%s` SET `%s`=null WHERE `%s`=0', + $params['table'], $params['id'], $params['id'])); +} \ No newline at end of file