CREATE TABLE IF NOT EXISTS `mod_dragon_legacy_unlocked` (
  `guid` INT UNSIGNED NOT NULL,
  PRIMARY KEY (`guid`)
) ENGINE=InnoDB;

-- Migration from the v1 learnSpell-based unlock (see PLAN.md "v1.1: spell -> command pivot"):
-- carry forward "already unlocked" for anyone who got the old spell grant, so no one loses
-- progress, then remove the now-unused character_spell rows. Kept in this file (not a separate
-- updates/ file) because the module's SQL updater orders all files by filename alone, not by
-- base/updates subdirectory -- a date-stamped updates/ file can sort before the base file that
-- creates the table it depends on. Idempotent, safe to run every startup.
INSERT IGNORE INTO `mod_dragon_legacy_unlocked` (`guid`)
SELECT DISTINCT `guid` FROM `character_spell` WHERE `spell` IN (900000, 900001);

DELETE FROM `character_spell` WHERE `spell` IN (900000, 900001);