<?php
/**
 * @version		$Id$
 * @package		ARTIO Booking
 * @copyright	Copyright (C) 2010 ARTIO s.r.o.. All rights reserved.
 * @author 		ARTIO s.r.o., http://www.artio.net
 * @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
 * @link        http://www.artio.net Official website
 */

defined('_JEXEC') or die('Restricted access');

/* @var $this BookingModelUpgrade */

require_once dirname(__FILE__) . '/reinstall.php';

$db = JFactory::getDBO();

$data = $db->getTableFields('#__booking_supplement');
if (!isset($data['#__booking_supplement']['unit_multiply']))
    $this->_addSQL('ALTER TABLE `#__booking_supplement` ADD `unit_multiply` TINYINT NOT NULL');

$data = $db->getTableFields('#__booking_customer');
if (!isset($data['#__booking_customer']['fields']))
    $this->_addSQL('ALTER TABLE `#__booking_customer` ADD `fields` LONGTEXT NOT NULL');

$data = $db->getTableFields('#__booking_reservation');
if (!isset($data['#__booking_reservation']['fields']))
    $this->_addSQL('ALTER TABLE `#__booking_reservation` ADD `fields` LONGTEXT NOT NULL');

$data = $db->getTableFields('#__booking_reservation_supplement');
if (!isset($data['#__booking_reservation_supplement']['boxsCount']))
    $this->_addSQL('ALTER TABLE `#__booking_reservation_supplement` ADD `boxsCount` INT NOT NULL');
?>