UpgradeRegionsTableToVersion3.sql 551 B

123456789101112131415161718
  1. DROP PROCEDURE IF EXISTS upgraderegions3;
  2. create procedure upgraderegions3()
  3. BEGIN
  4. DECLARE db_name varchar(64);
  5. select database() into db_name;
  6. IF ((select count(*) from information_schema.columns where table_name='regions' and column_name='owner_uuid' and table_schema=db_name) > 0)
  7. THEN
  8. ALTER TABLE `regions`, COMMENT='Rev. 3';
  9. ELSE
  10. ALTER TABLE `regions`
  11. ADD COLUMN `owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null after serverRemotingPort, COMMENT='Rev. 3';
  12. END IF;
  13. END;
  14. call upgraderegions3();