-- http://www.phpmyadmin.net
--
-- Erstellungszeit: 19. Nov 2013 um 14:10
-- Server Version: 5.5.31
-- PHP-Version: 5.3.27




--
-- Datenbank: `cacenter`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `accounts`
--

CREATE TABLE IF NOT EXISTS `accounts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `site_id` smallint(5) unsigned DEFAULT NULL,
  `login` varchar(160) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `password` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `state` smallint(5) unsigned NOT NULL,
  `valid_from` datetime DEFAULT NULL,
  `valid_until` datetime DEFAULT NULL,
  `authtoken` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `last_login` datetime DEFAULT NULL,
  `last_active` datetime DEFAULT NULL,
  `failed_login_count` int(11) NOT NULL DEFAULT '0',
  `failed_login_last` datetime DEFAULT NULL,
  `failed_login_lastsrc` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `seed` int(10) unsigned NOT NULL,
  `masteradmin` tinyint(1) NOT NULL COMMENT 'boolean',
  PRIMARY KEY (`id`),
  KEY `sitelogin` (`site_id`,`login`(4))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `acl`
--

CREATE TABLE IF NOT EXISTS `acl` (
  `account_id` bigint(20) unsigned NOT NULL,
  `group_id` int(10) unsigned NOT NULL,
  `site_id` smallint(5) unsigned NOT NULL,
  `instance` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `key` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `value` smallint(6) NOT NULL DEFAULT '0',
  KEY `ids` (`account_id`,`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `groupmembers`
--

CREATE TABLE IF NOT EXISTS `groupmembers` (
  `group_id` int(10) unsigned NOT NULL,
  `account_id` bigint(20) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `groups`
--

CREATE TABLE IF NOT EXISTS `groups` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `site_id` smallint(5) unsigned DEFAULT NULL,
  `name` varchar(160) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `state` smallint(5) unsigned NOT NULL,
  `masteradmin` tinyint(1) NOT NULL COMMENT 'boolean',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `installinfo`
--

CREATE TABLE IF NOT EXISTS `installinfo` (
  `type` enum('system','plugin','module','comp') NOT NULL,
  `key` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `version` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `attrib` int(10) unsigned NOT NULL,
  PRIMARY KEY (`type`,`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Daten für Tabelle `installinfo`
--

INSERT INTO `installinfo` (`type`, `key`, `version`, `attrib`) VALUES
('system', 'cadb', '0.1.0.0', 0);

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `log`
--

CREATE TABLE IF NOT EXISTS `log` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `parent` bigint(20) DEFAULT NULL,
  `eventtime` datetime NOT NULL,
  `site_id` smallint(6) DEFAULT NULL,
  `level` smallint(6) NOT NULL,
  `area` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `areaname` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `user` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `code` int(11) DEFAULT NULL,
  `message` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id`),
  KEY `event` (`eventtime`,`site_id`,`level`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `websitesettings`
--

CREATE TABLE IF NOT EXISTS `websitesettings` (
  `site_id` smallint(6) NOT NULL,
  `instance` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `key` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  KEY `site_instance` (`site_id`,`instance`(4))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

