CREATE TABLE IF NOT EXISTS `rankedVote` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agora_id` smallint NOT NULL,
  `title` varchar(64) NOT NULL,
  `open` datetime,
  `close` datetime,
  `published` BOOLEAN NOT NULL DEFAULT '0',
  `schultze_d` TEXT,
  `schultze_p` TEXT,
  
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS `rankedVoteOptions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `rankedVoteOption` varchar(128),
  `rankedVote_id` int(11),
  `ranking` int(11),
  `description` varchar(256),
  
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS `rankedVoteBallots` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ticket` int(11),
  `rankedVote_id` int(11) NOT NULL,
  `rankedVoteOption_id` int(11),
  `ranking` int(11),
  `body` char(3),
  `delegate` varchar(100),
  
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

ALTER TABLE `notifications` CHANGE `type` `type` ENUM( 'Proposal', 'Rollcall', 'Election', 'Poll', 'RankedVote' ) DEFAULT NULL 

ALTER TABLE `voting_delegates` ADD `status` VARCHAR(20) AFTER `BodyCode`;
ALTER TABLE `voting_delegates` ADD PRIMARY KEY( `participantId`);