DROP TABLE IF EXISTS `raw_item_classes`;
DROP TABLE IF EXISTS `raw_item_skill_classes`;

ALTER TABLE `raw_items` 
	ADD COLUMN `adventure_classes` BIGINT(20) UNSIGNED DEFAULT '0' NOT NULL AFTER `adventure_default_level`, 
	ADD COLUMN `tradeskill_classes` BIGINT(20) UNSIGNED DEFAULT '0' NOT NULL AFTER `adventure_classes`,
	CHANGE `required_level` `adventure_default_level` SMALLINT(5) UNSIGNED DEFAULT '0' NOT NULL,
	ADD COLUMN `tradeskill_default_level` SMALLINT(5) UNSIGNED DEFAULT '0' NOT NULL AFTER `adventure_default_level`;

ALTER TABLE `raw_item_details_skills` 
	ADD COLUMN `adventure_classes` BIGINT(20) UNSIGNED DEFAULT '0' NOT NULL AFTER `unknown26`, 
	ADD COLUMN `tradeskill_classes` BIGINT(20) UNSIGNED DEFAULT '0' NOT NULL AFTER `adventure_classes`, 
	ADD COLUMN `adventure_default_level` SMALLINT(5) UNSIGNED DEFAULT '0' NOT NULL AFTER `tradeskill_classes`, 
	ADD COLUMN `tradeskill_default_level` SMALLINT(5) UNSIGNED DEFAULT '0' NOT NULL AFTER `adventure_default_level`;

DROP TABLE IF EXISTS `raw_item_details_skill`;
CREATE TABLE `raw_item_details_skill` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`spell_tier` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
	`language_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY  (`id`),
	UNIQUE KEY `NewIndex1` (`item_id`,`language_type`,`spell_id`,`spell_tier`)
) ENGINE=MYISAM;

ALTER TABLE `raw_spawn_info` DROP COLUMN `populate_spawn_id`, DROP COLUMN `processed`;
ALTER TABLE `raw_spawns` ADD COLUMN `populate_spawn_id` INT(10) UNSIGNED DEFAULT '0' NOT NULL AFTER `language_type`;


ALTER TABLE `opcodes` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_collections` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_conversations` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_dialog_choices` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_dialogs` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_entity_commands` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_factions` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_appearances` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_descriptions` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_armor` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_armorset` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_bag` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_bauble` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_book` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_food` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_house` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_house_container` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_pattern` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_range` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_recipe` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_recipe_items` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_shield` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_skill` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_skills` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_thrown` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_details_weapon` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_effects` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_sets` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_sets_effects` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_sets_stats` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_item_stats` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_items` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_map_data` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_merchant_items` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_quest_reward_factions` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_quest_reward_items` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_quest_taskgroup_tasks` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_quest_taskgroup_taskupdates` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_quest_taskgroups` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_quests` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_sounds` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_appearance` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_appearance_equip` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_groups` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_info` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_signs` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_unknowns` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawn_widgets` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spawns` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spell_details` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spell_effects` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spell_levels` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_spells` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_zone_points` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;
ALTER TABLE `raw_zones` ENGINE=MYISAM CHECKSUM=1 AUTO_INCREMENT=1 COMMENT='' DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC CHARSET=latin1 COLLATE=latin1_swedish_ci;

ALTER TABLE `raw_spell_details` ADD COLUMN `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,CHANGE `spell_id` `spell_id` INT(10) UNSIGNED DEFAULT '0' NOT NULL, CHANGE `tier` `tier` TINYINT(3) UNSIGNED DEFAULT '0' NOT NULL, DROP PRIMARY KEY,  ADD PRIMARY KEY(`id`);
ALTER TABLE `raw_spell_details` ADD UNIQUE `NewIndex1` (`spell_id`, `tier`);

ALTER TABLE `raw_spell_effects` ADD COLUMN `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,CHANGE `spell_id` `spell_id` INT(10) UNSIGNED DEFAULT '0' NOT NULL, CHANGE `tier` `tier` TINYINT(3) UNSIGNED DEFAULT '0' NOT NULL, CHANGE `index` `index` TINYINT(3) UNSIGNED DEFAULT '0' NOT NULL, DROP PRIMARY KEY,  ADD PRIMARY KEY(`id`);
ALTER TABLE `raw_spell_effects` ADD UNIQUE `NewIndex1` (`spell_id`, `tier`, `index`);

ALTER TABLE `raw_spell_levels` ADD COLUMN `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,CHANGE `spell_id` `spell_id` INT(10) UNSIGNED NOT NULL, CHANGE `tier` `tier` TINYINT(3) UNSIGNED DEFAULT '0' NOT NULL, CHANGE `adventure_class_id` `adventure_class_id` TINYINT(3) UNSIGNED DEFAULT '0' NOT NULL, CHANGE `tradeskill_class_id` `tradeskill_class_id` TINYINT(3) UNSIGNED DEFAULT '0' NOT NULL, DROP PRIMARY KEY,  ADD PRIMARY KEY(`id`);
ALTER TABLE `raw_spell_levels` ADD UNIQUE `NewIndex1` (`spell_id`, `tier`, `adventure_class_id`, `tradeskill_class_id`);
