Skip to content

Commit

Permalink
Added a test in the tthumbs element to see if the table has a 'tableid'
Browse files Browse the repository at this point in the history
field instead of 'listid' (i.e. it was originally installed on 2.x) and
if so, rename the column.
  • Loading branch information
cheesegrits committed Oct 27, 2015
1 parent 474fa28 commit 49f4a8e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion plugins/fabrik_element/thumbs/thumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,21 @@ public function install()
$db->setQuery($query);
$db->execute();

// Update for comments plugin needs special column adding
/**
* Check if we need to update the table ...
*
* Update for comments plugin needs 'special' column adding,,
* Check for older versions of the table needing tableid chenged to listid
*/

$cols = $db->getTableColumns('#__{package}_thumbs');

if (array_key_exists('tableid', $cols))
{
$db->setQuery('ALTER TABLE #__{package}_thumbs CHANGE ' . $db->qn('tableid') . ' ' . $db->qn('listid') . ' INT(6)');
$db->execute();
}

if (!array_key_exists('special', $cols))
{
$db->setQuery('ALTER TABLE #__{package}_thumbs ADD COLUMN ' . $db->qn('special') . ' VARCHAR(30)');
Expand Down

0 comments on commit 49f4a8e

Please sign in to comment.