--
-- Host: localhost    Database: dir_xiph_org
-- ------------------------------------------------------


--
-- Table structure for table `media_type`
--

CREATE TABLE `media_type` (
  `id` int(10) unsigned NOT NULL,
  `media_type_name` varchar(255) collate utf8_unicode_ci NOT NULL,
  `media_type_url` varchar(255) collate utf8_unicode_ci NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `media_type_url` (`media_type_url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `cascade_listeners_on_delete_mountpoint` AFTER DELETE ON `mountpoint` FOR EACH ROW DELETE FROM mountpoint_data WHERE mountpoint_id = OLD.id */;;

DELIMITER ;

--
-- Table structure for table `mountpoint_data`
--

CREATE TABLE `mountpoint_data` (
  `mountpoint_id` int(10) unsigned NOT NULL,
  `listeners` int(11) NOT NULL,
  `current_song` char(255) default NULL,
  PRIMARY KEY  (`mountpoint_id`),
  KEY `listeners` (`listeners`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8;

--
-- Table structure for table `mountpoints_tags`
--

CREATE TABLE `mountpoints_tags` (
  `mountpoint_id` int(10) unsigned NOT NULL,
  `tag_id` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`mountpoint_id`,`tag_id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1;

--
-- Table structure for table `server`
--

CREATE TABLE `server` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `mountpoint_id` int(10) unsigned NOT NULL,
  `sid` char(36) character set ascii NOT NULL,
  `listen_url` char(255) character set latin1 NOT NULL,
  `listeners` int(10) unsigned NOT NULL,
  `max_listeners` int(10) unsigned default NULL,
  `current_song` char(255) default NULL,
  `checked` tinyint(3) unsigned NOT NULL default '0',
  `checked_at` timestamp NULL default NULL,
  `last_touched_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `last_touched_from` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `listen_url` (`listen_url`),
  KEY `sid` (`sid`),
  KEY `mountpoint_id` (`mountpoint_id`)
) ENGINE=MEMORY AUTO_INCREMENT=45458591 DEFAULT CHARSET=utf8;

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;;

/*!50003 SET SESSION SQL_MODE="" */;;;

/*!50003 SET SESSION SQL_MODE="" */;;;

DELIMITER ;

--
-- Table structure for table `tag`
--

CREATE TABLE `tag` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `tag_name` varchar(20) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `tag_name` (`tag_name`)
) ENGINE=MEMORY AUTO_INCREMENT=8339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Table structure for table `tag_cloud`
--

CREATE TABLE `tag_cloud` (
  `tag_id` int(10) unsigned NOT NULL,
  `tag_usage` int(11) NOT NULL,
  PRIMARY KEY  (`tag_id`),
  KEY `tag_usage` (`tag_usage`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1;


