Modified database for piwik: added an uniq index to user, and a piwik_sites table

This commit is contained in:
François Serman 2012-08-24 15:05:22 +00:00
parent 85d4bc5723
commit 6669a07434
2 changed files with 44 additions and 13 deletions

View File

@ -693,10 +693,25 @@ where (`v`.`name` = 'mailname_bounce');
-- Structure de la table `piwik_users`
--
CREATE TABLE IF NOT EXISTS `piwik_users` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT NOT NULL ,
`login` VARCHAR( 255 ) NOT NULL ,
`created_date` TIMESTAMP NOT NULL
) ENGINE = MYISAM ;
CREATE TABLE IF NOT EXISTS `piwik_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`login` varchar(255) NOT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_user` (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
--
-- Structure de la table `piwik_sites`
--
CREATE TABLE IF NOT EXISTS `piwik_sites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`piwik_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_site_per_user` (`uid`,`piwik_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

View File

@ -166,12 +166,28 @@ CREATE TABLE IF NOT EXISTS `cron` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Piwik user tables
-- Structure de la table `piwik_users`
--
CREATE TABLE IF NOT EXISTS `piwik_users` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT NOT NULL ,
`login` VARCHAR( 255 ) NOT NULL ,
`created_date` TIMESTAMP NOT NULL
) ENGINE = MYISAM ;
CREATE TABLE IF NOT EXISTS `piwik_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`login` varchar(255) NOT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_user` (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
--
-- Structure de la table `piwik_sites`
--
CREATE TABLE IF NOT EXISTS `piwik_sites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`piwik_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_site_per_user` (`uid`,`piwik_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;