-- <?php /** $Id: installsql.mysql.utf8.php 134 2009-06-24 05:52:18Z eddieajau $ */ defined('_JEXEC') or die() ?>;

CREATE TABLE IF NOT EXISTS `#__taoj` (
  `id` int(10) NOT NULL auto_increment,
  `extension` varchar(100) NOT NULL COMMENT 'The extension',
  `version` varchar(16) NOT NULL COMMENT 'Version number',
  `installed_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT 'Date-time modified or installed',
  `log` mediumtext,
  PRIMARY KEY  USING BTREE (`id`),
  KEY `idx_extension` (`extension`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='The Art of Joomla extension version history';

--
-- Table to store adhoc JSON charts.
--

CREATE TABLE IF NOT EXISTS `#__taoj_quanta_charts` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(100) NOT NULL default '',
  `alias` varchar(100) NOT NULL default '',
  `published` tinyint(4) NOT NULL default '0',
  `access` tinyint(3) unsigned NOT NULL default '0',
  `description` varchar(5120) NOT NULL,
  `code` varchar(5120) NOT NULL,
  `chart_version` varchar(10) NOT NULL default '0',
  `chart_width` smallint(5) unsigned NOT NULL default '300',
  `chart_height` smallint(5) unsigned NOT NULL default '300',
  `created_user_id` int(11) NOT NULL default '0',
  `created_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `modified_user_id` int(11) NOT NULL default '0',
  `modified_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `checked_out` int(11) NOT NULL default '0',
  `checked_out_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `category_id` int(10) unsigned NOT NULL default '0' COMMENT 'Foreign key to jos_categories.id',
  `metadesc` varchar(512) NOT NULL,
  `metakey` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `idx_published` (`published`),
  KEY `idx_category_id` (`category_id`),
  KEY `idx_alias` (`alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Table to store historic data values.
--

CREATE TABLE IF NOT EXISTS `#__taoj_quanta_history` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `record_id` int(11) NOT NULL,
  `record_value` double NOT NULL default '0',
  `record_value2` double NOT NULL default '0' COMMENT 'An optional second value to store with the entry (to allow for high-low values).',
  `record_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `published` int(11) NOT NULL default '1',
  `user_id` int(10) unsigned NOT NULL default '0' COMMENT 'An optional owner for the historic entry.',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `idx_record_id_time` (`record_id`,`record_time`),
  KEY `idx_published` (`published`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Table to objects that are being recorded.
--

CREATE TABLE IF NOT EXISTS `#__taoj_quanta_records` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(100) NOT NULL default '',
  `alias` varchar(100) NOT NULL default '',
  `label` varchar(10) NOT NULL COMMENT 'The label for the graph axis.',
  `published` tinyint(4) NOT NULL default '0',
  `access` tinyint(3) unsigned NOT NULL default '0',
  `description` varchar(5120) NOT NULL,
  `maximum_value` double NOT NULL default '0' COMMENT 'The maximum measurable value',
  `latest_value` double NOT NULL default '0' COMMENT 'A copy of the latest available value',
  `latest_value2` double NOT NULL default '0',
  `latest_time` timestamp NOT NULL default '0000-00-00 00:00:00' COMMENT 'The time that applies to the latest value',
  `created_user_id` int(11) NOT NULL default '0',
  `created_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `modified_user_id` int(11) NOT NULL default '0',
  `modified_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `checked_out` int(11) NOT NULL default '0',
  `checked_out_time` timestamp NOT NULL default '0000-00-00 00:00:00',
  `category_id` int(10) unsigned NOT NULL default '0' COMMENT 'Foreign key to jos_categories.id',
  `params` varchar(5120) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `idx_published` (`published`),
  KEY `idx_alias` (`alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


