<?php
/**
 * JComments Table ETL
 * 
 * @version 2.0
 * @package Migrator
 * @author Sergey M. Litvinov (smart@joomlatune.ru)
 * @copyright (C) 2008-2009 by Sergey M. Litvinov (http://www.joomlatune.ru)
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 */

class JComments_ETL extends ETLPlugin
{
	function getName()
	{
		return "JComments ETL Plugin";
	}
	
	function getAssociatedTable()
	{
		return 'jcomments';
	}
	
	function mapvalues( $key, $value )
	{
		switch ($key) {
			default:
				return $value;
				break;
		}
	}

	function getSQLPrologue()
	{
		$ret = <<<EOT

CREATE TABLE IF NOT EXISTS `#__jcomments` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`parent` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`path` VARCHAR(255) NOT NULL DEFAULT '',
`level` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`object_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`object_group` VARCHAR(255) NOT NULL DEFAULT '',
`object_params` TEXT NOT NULL DEFAULT '',
`lang` VARCHAR(255) NOT NULL DEFAULT '',
`userid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`name`VARCHAR(255) NOT NULL DEFAULT '',
`username`VARCHAR(255) NOT NULL DEFAULT '',
`email` VARCHAR(255) NOT NULL DEFAULT '',
`homepage` VARCHAR(255) NOT NULL DEFAULT '',
`title` VARCHAR(255) NOT NULL DEFAULT '',
`comment` TEXT NOT NULL DEFAULT '',
`ip` VARCHAR(15) NOT NULL DEFAULT '',
`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`isgood` SMALLINT(5) UNSIGNED NOT NULL default '0',
`ispoor` SMALLINT(5) UNSIGNED NOT NULL default '0',
`published` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`subscribe` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`source` VARCHAR(255) NOT NULL DEFAULT '',
`source_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`checked_out` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`editor` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY  (`id`),
KEY `idx_userid` (`userid`),
KEY `idx_source` (`source`),
KEY `idx_email` (`email`),
KEY `idx_lang` (`lang`),
KEY `idx_subscribe` (`subscribe`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_object` (`object_id`, `object_group`, `published`, `date`),
KEY `idx_path` (`path`, `level`)
) TYPE=MyISAM CHARACTER SET `utf8` COLLATE `utf8_general_ci`;
    
EOT;
        return $ret;
    }
}
?>