Hello
I updating my TL to version 2.8.0. Unfortunately, I noticed that the file database.sql in news module, there is no tl_news_comments table. Currently in this table have 1200 news comments. Is there any advice how to keep them?
Printable View
Hello
I updating my TL to version 2.8.0. Unfortunately, I noticed that the file database.sql in news module, there is no tl_news_comments table. Currently in this table have 1200 news comments. Is there any advice how to keep them?
After uploading the new files, you need to update the dababase by install.php.
Install.php will detect that you are upgrading from 2.7.x and automatically migrate the data into tl_comments.
Here is the snippet in install.php handling the transition:
Code:// News comments
$objComment = $this->Database->execute("SELECT * FROM tl_news_comments");
while ($objComment->next())
{
$arrSet = $objComment->row();
$arrSet['source'] = 'tl_news';
$arrSet['parent'] = $arrSet['pid'];
unset($arrSet['id']);
unset($arrSet['pid']);
$this->Database->prepare("INSERT INTO tl_comments %s")->set($arrSet)->execute();
}
// Delete system/modules/news/Comments.php
$this->import('Files');
$this->Files->delete('system/modules/news/Comments.php');
$this->reload();