Skip to content

Instantly share code, notes, and snippets.

@MiLk
Created September 22, 2010 10:03
Show Gist options
  • Save MiLk/591444 to your computer and use it in GitHub Desktop.
Save MiLk/591444 to your computer and use it in GitHub Desktop.
ALTER TABLE `arena_team` ADD INDEX ( `captainguid` );
ALTER TABLE `arena_team` ADD FOREIGN KEY ( `captainguid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE `arena_team_member` ADD FOREIGN KEY ( `arenateamid` ) REFERENCES `arena_team` (`arenateamid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `arena_team_member` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `arena_team_stats` ADD FOREIGN KEY ( `arenateamid` ) REFERENCES `arena_team` (`arenateamid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `auction` ADD FOREIGN KEY ( `itemguid` ) REFERENCES item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `auction` ADD INDEX ( `itemowner` );
ALTER TABLE `auction` ADD FOREIGN KEY ( `itemowner` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_action` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_aura` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_aura` ADD FOREIGN KEY ( `item_guid` ) REFERENCES `item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_declinedname` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_gifts` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_gifts` ADD FOREIGN KEY ( `item_guid` ) REFERENCES `item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_homebind` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_instance` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_instance` ADD FOREIGN KEY ( `instance` ) REFERENCES `instance` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_inventory` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_inventory` ADD FOREIGN KEY ( `item` ) REFERENCES `item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_pet` ADD FOREIGN KEY ( `owner` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_pet_declinedname` ADD FOREIGN KEY ( `id` ) REFERENCES `character_pet` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_pet_declinedname` ADD FOREIGN KEY ( `owner` ) REFERENCES `character_pet` (`owner`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_queststatus` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_queststatus_daily` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_reputation` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_skills` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_social` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_social` ADD FOREIGN KEY ( `friend` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_spell` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_spell_cooldown` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_stats` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `character_ticket` ADD INDEX ( `guid` );
ALTER TABLE `character_ticket` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `corpse` ADD FOREIGN KEY ( `player` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `groups` ADD INDEX ( `mainTank` );
ALTER TABLE `groups` ADD INDEX ( `mainAssistant` );
ALTER TABLE `groups` ADD FOREIGN KEY ( `leaderGuid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `groups` ADD FOREIGN KEY ( `mainTank` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `groups` ADD FOREIGN KEY ( `mainAssistant` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `group_instance` ADD FOREIGN KEY ( `leaderGuid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `group_instance` ADD FOREIGN KEY ( `instance` ) REFERENCES `instance` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `group_member` ADD FOREIGN KEY ( `groupId` ) REFERENCES `groups` (`groupId`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `group_member` ADD FOREIGN KEY ( `memberGuid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild` ADD INDEX ( `leaderguid` );
ALTER TABLE `guild` ADD FOREIGN KEY ( `leaderguid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_eventlog` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_eventlog` ADD FOREIGN KEY ( `PlayerGuid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_eventlog` ADD FOREIGN KEY ( `guildid` , `TabId` ) REFERENCES `guild_bank_tab` ( `guildid` , `TabId` ) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_item` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_item` ADD FOREIGN KEY ( `item_guid` ) REFERENCES `item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_item` ADD FOREIGN KEY ( `guildid` , `TabId` ) REFERENCES `guild_bank_tab` ( `guildid` , `TabId` ) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_right` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_right` ADD FOREIGN KEY ( `guildid` , `TabId` ) REFERENCES `guild_bank_tab` ( `guildid` , `TabId` ) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_bank_tab` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_eventlog` CHANGE `guildid` `guildid` INT( 6 ) UNSIGNED NOT NULL COMMENT 'Guild Identificator';
ALTER TABLE `guild_eventlog` CHANGE `PlayerGuid1` `PlayerGuid1` INT( 11 ) UNSIGNED NOT NULL COMMENT 'Player 1';
ALTER TABLE `guild_eventlog` CHANGE `PlayerGuid2` `PlayerGuid2` INT( 11 ) UNSIGNED NOT NULL COMMENT 'Player 2';
ALTER TABLE `guild_eventlog` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_eventlog` ADD FOREIGN KEY ( `PlayerGuid1` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_eventlog` ADD FOREIGN KEY ( `PlayerGuid2` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_member` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_member` ADD FOREIGN KEY ( `guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `guild_rank` ADD FOREIGN KEY ( `guildid` ) REFERENCES `guild` (`guildid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `item_instance` ADD FOREIGN KEY ( `owner_guid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `mail` ADD INDEX ( `sender` );
ALTER TABLE `mail` ADD FOREIGN KEY ( `sender` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `mail` ADD FOREIGN KEY ( `receiver` ) REFERENCES `character_skills` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `mail_items` CHANGE `mail_id` `mail_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `mail_items` CHANGE `item_guid` `item_guid` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `mail_items` ADD FOREIGN KEY ( `mail_id` ) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `mail_items` ADD FOREIGN KEY ( `item_guid` ) REFERENCES `item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `mail_items` ADD FOREIGN KEY ( `receiver` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `petition` ADD FOREIGN KEY ( `ownerguid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `petition_sign` ADD FOREIGN KEY ( `ownerguid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `petition_sign` ADD FOREIGN KEY ( `playerguid` ) REFERENCES `characters` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `pet_aura` ADD FOREIGN KEY ( `item_guid` ) REFERENCES `item_instance` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `pet_spell` ADD FOREIGN KEY ( `guid` ) REFERENCES `character_pet` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
ALTER TABLE `pet_spell_cooldown` ADD FOREIGN KEY ( `guid` ) REFERENCES `character_pet` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment