protected function _getVersion()
    {
        if (!isset($this->_version)) {
            //if table doesn't exists
                $this->_db->execute(<<<EOF
CREATE TABLE IF NOT EXISTS `#__migrator_versions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `component` varchar(255) NOT NULL,
  `version` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `component` (`component`)
)ENGINE=InnoDB;
EOF
                );
            $this->_version = $this->getService('repos:migrator.version')
                    ->findOrAddNew(array('component' => $this->_component));
        }

        return $this->_version;
    }