BEGIN;
   
DROP TABLE IF EXISTS `licenses`;
CREATE TABLE `licenses` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `name` int(1) NOT NULL default '-1',
  `text` int(11) unsigned NULL,
  `created` datetime NOT NULL default '0000-00-00 00:00:00',
  `modified` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `text` (`text`),
  CONSTRAINT `licenses_ibfk_1` FOREIGN KEY (`text`) REFERENCES `translations` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `versions`
  ADD COLUMN `license_id` int(11) unsigned NULL AFTER `addon_id`,
  ADD KEY `license_id` (`license_id`),
  ADD CONSTRAINT `versions_ibfk_3` FOREIGN KEY (`license_id`) REFERENCES `licenses` (`id`);
  
ALTER TABLE `addons`
  ADD COLUMN `dev_agreement` tinyint(1) unsigned NOT NULL default '0' AFTER `nominationdate`;

COMMIT;
