1.0.2.sql 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ALTER TABLE `qinq` ADD `svlan_id` int(10) NOT NULL AFTER `svlan`;
  2. ALTER TABLE `qinq` DROP `svlan`;
  3. RENAME TABLE `qinq` TO `qinq_bindings`;
  4. CREATE TABLE IF NOT EXISTS `realms` (
  5. `id` int(11) NOT NULL AUTO_INCREMENT,
  6. `realm` varchar(255) NOT NULL,
  7. `description` varchar(255) NULL,
  8. PRIMARY KEY (`id`),
  9. KEY (`realm`)
  10. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  11. INSERT INTO `realms` (`id`,`realm`,`description`) VALUES (1, 'default', 'default realm');
  12. CREATE TABLE IF NOT EXISTS `qinq_svlan` (
  13. `id` int(11) NOT NULL AUTO_INCREMENT,
  14. `realm_id` int(11) NOT NULL,
  15. `svlan` int(4) NOT NULL,
  16. `description` varchar(255) NULL,
  17. PRIMARY KEY (`id`),
  18. KEY (`realm_id`),
  19. KEY (`svlan`)
  20. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  21. INSERT INTO `qinq_svlan` (`id`, `realm_id`, `svlan`, `description`) VALUES (1, 1, 0, 'Use it for untagged VLAN');
  22. INSERT INTO `qinq_svlan` (`id`, `realm_id`, `svlan`) SELECT DISTINCT NULL, 1, `svlan` FROM `switches_qinq`;
  23. ALTER TABLE `switches_qinq` ADD `svlan_id` int(11) NOT NULL AFTER `switchid`;
  24. ALTER TABLE `switches_qinq` ADD KEY (`svlan_id`);
  25. UPDATE `switches_qinq` AS `swq`, `qinq_svlan` AS `qsv` SET `swq`.`svlan_id` = `qsv`.`id` WHERE `swq`.`svlan` = `qsv`.`svlan` AND `qsv`.`realm_id` =1;
  26. ALTER TABLE `switches_qinq` DROP `svlan`;