ALTER TABLE `qs_People` DROP `url`;

ALTER TABLE  `qs_People` ENGINE = INNODB;


CREATE TABLE IF NOT EXISTS `qs_PeopleSocialLink` (
  `peopleId` int(11) NOT NULL,
  `linkId` int(11) NOT NULL,
  `link` varchar(255) NOT NULL,
  `added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  UNIQUE KEY `idPeopleLink` (`peopleId`,`linkId`),
  KEY `linkId` (`linkId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `qs_SocialLinkDictionary` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `iconName` varchar(30) NOT NULL,
  `serviceName` varchar(30) NOT NULL,
  `sorter` int(11) NOT NULL,
  `show` enum('y','n') NOT NULL DEFAULT 'y',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;

INSERT INTO `qs_SocialLinkDictionary` (`id`, `iconName`, `serviceName`, `sorter`, `show`) VALUES
(1, 'facebook', 'Facebook', 0, 'y'),
(2, 'twitter', 'Twitter', 1, 'y'),
(3, 'linkedin', 'LinkedIn', 2, 'y'),
(4, 'google-plus', 'Google+', 3, 'y');

ALTER TABLE `qs_PeopleSocialLink`
  ADD CONSTRAINT `qs_PeopleSocialLink_ibfk_2` FOREIGN KEY (`peopleId`) REFERENCES `qs_People` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `qs_PeopleSocialLink_ibfk_1` FOREIGN KEY (`linkId`) REFERENCES `qs_SocialLinkDictionary` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

