Database cleaning tool

Z WoWResource Wiki
Verze z 5. 2. 2010, 08:59, kterou vytvořil Chronos (diskuse | příspěvky) (Oprava kategorie)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Přejít na: navigace, hledání

Úvod

Tento PHP skript slouží jako pomůcka pro kontrolu integrity databáze a její následné pročištění. Kontroluje především vadné vazby mezi tabulkami, které jsou obvykle zachovávány v SQL databázích pomocí tzv. cizích klíčů (foreign keys). Ovšem databázový engine MyISAM, který je často použit pro MySQL databáze, cizí klíče nepodporuje.

Tento skript také umožňuje mazání starých herních účtu starších než zadaný počet měsíců.

V souboru definition.php si lze snadno upravit nebo doplnit další chybějící vazby mezi tabulkami. Samotná struktura tabulek emulátoru MaNGOS se průběžně mění.

Soubor index.php

<?php

// Configuration
$HostName = 'localhost';
$UserName = 'user';
$Password = 'heslo';
$RealmdSchema = 'realmd';
$MangosSchema = 'mangos';
$CharactersSchema = 'characters';


include('definition.php');

class CleaningTool
{
  var $Database;
  var $Relations;
  var $RealmdSchema;
  var $MangosSchema;
  var $CharactersSchema;
  
  function FlushOutput(&$Output)
  {
    echo($Output);
    $Output = '';
    echo(str_repeat(' ', 30000));  // Fill server output buffer
    flush();
  }

  function CheckCorruptedRelations()
  { 
    $Output = '<strong>Check corrupted relations</strong><br/>'.
    '<table><tr><th colspan="3">Source</th><th colspan="3">Target</th><th rowspan="2">Total count</th><th rowspan="2">Invalid count</th><th rowspan="2">Percent[%]</th></tr>'.
    '<tr><th>Schema</th><th>Table</th><th>Column</th><th>Schema</th><th>Table</th><th>Column</th></tr>';
    foreach($this->Relations as $Key)
    {
      $Query = 'SELECT COUNT(*) FROM '.$Key['SourceSchema'].'.'.$Key['SourceTable'];
      $DbResult = $this->Database->query($Query);
      $Output .= $this->Database->error;
      $DbRow = $DbResult->fetch_row();
      $TotalCount = $DbRow[0];

      $Query = 'SELECT COUNT(*) FROM '.$Key['SourceSchema'].'.'.$Key['SourceTable'].' WHERE ('.$Key['SourceColumn'].' NOT IN (SELECT '.$Key['TargetColumn'].' FROM '.$Key['TargetSchema'].'.'.$Key['TargetTable'].')) AND ('.$Key['SourceColumn'].' != 0)';
      $DbResult = $this->Database->query($Query);
      $Output .= $this->Database->error;
      $DbRow = $DbResult->fetch_row();
      $Count = $DbRow[0];
    
      $Output .= '<tr><td>'.$Key['SourceSchema'].'</td><td>'.$Key['SourceTable'].'</td><td>'.$Key['SourceColumn'].'</td>'.
    '<td>'.$Key['TargetSchema'].'</td><td>'.$Key['TargetTable'].'</td><td>'.$Key['TargetColumn'].'</td><td>'.$TotalCount.'</td><td>'.$Count.'</td><td>'.round($Count / $TotalCount * 100, 2).'</td></tr>';
      $this->FlushOutput($Output);
    }
    $Output .= '</table>';
    return($Output);
  }

  function DeleteCorruptedRelations()
  { 
    $Output = '<strong>Delete corrupted relations</strong><br/>'.
    '<table><tr><th colspan="3">Source</th><th colspan="3">Target</th><th rowspan="2">Total count</th><th rowspan="2">Deleted count</th><th rowspan="2">Percent[%]</th></tr>'.
  '<tr><th>Schema</th><th>Table</th><th>Column</th><th>Schema</th><th>Table</th><th>Column</th></tr>';
    foreach($this->Relations as $Key)
    {
      $Query = 'SELECT COUNT(*) FROM '.$Key['SourceSchema'].'.'.$Key['SourceTable'];
      $DbResult = $this->Database->query($Query);
      $Output .= $this->Database->error;
      $DbRow = $DbResult->fetch_row();
      $TotalCount = $DbRow[0];

      $Output .= '<tr><td>'.$Key['SourceSchema'].'</td><td>'.$Key['SourceTable'].'</td><td>'.$Key['SourceColumn'].'</td>'.
      '<td>'.$Key['TargetSchema'].'</td><td>'.$Key['TargetTable'].'</td><td>'.$Key['TargetColumn'].'</td><td>'.$TotalCount.'</td>';
    
      $Query = 'DELETE FROM '.$Key['SourceSchema'].'.'.$Key['SourceTable'].' WHERE ('.$Key['SourceColumn'].' NOT IN (SELECT '.$Key['TargetColumn'].' FROM '.$Key['TargetSchema'].'.'.$Key['TargetTable'].')) AND ('.$Key['SourceColumn'].' != 0)';
      $DbResult = $this->Database->query($Query);
      $Output .= $this->Database->error;    
      $Count = $this->Database->affected_rows;

      $Output .= '<td>'.$Count.'</td><td>'.round($Count / $TotalCount * 100, 2).'</td></tr>';
      $this->FlushOutput($Output);
    }
    $Output .= '</table>';
    return($Output);
  }

  function ShowRelations()
  { 
    $Output = '<strong>Relations</strong><br/>'.
    '<table><tr><th colspan="3">Source</th><th colspan="3">Target</th><th rowspan="2">Total count</th></tr>'.
    '<tr><th>Schema</th><th>Table</th><th>Column</th><th>Schema</th><th>Table</th><th>Column</th></tr>';
    foreach($this->Relations as $Key)
    {
      $Query = 'SELECT COUNT(*) FROM '.$Key['SourceSchema'].'.'.$Key['SourceTable'];
      $DbResult = $this->Database->query($Query);
      echo($Database->error);
      $DbRow = $DbResult->fetch_row();
      $TotalCount = $DbRow[0];

      $Output .= '<tr><td>'.$Key['SourceSchema'].'</td><td>'.$Key['SourceTable'].'</td><td>'.$Key['SourceColumn'].'</td>'.
    '<td>'.$Key['TargetSchema'].'</td><td>'.$Key['TargetTable'].'</td><td>'.$Key['TargetColumn'].'</td><td>'.$TotalCount.'</td></tr>';
      $this->FlushOutput($Output);
    }
    $Output .= '</table>';
    return($Output);
  }

  function DeleteOldAccounts()
  {
    $this->Database->query('DELETE FROM '.$this->RealmdSchema.'.account WHERE last_login < DATE_SUB(NOW(), INTERVAL '.$_POST['months'].' MONTH)');
    echo($this->Database->error);
    $Output = 'Deleted '.$this->Database->affected_rows.' accounts. You should go back and check and delete relations now.';
    return($Output);
  }

  function Show()
  {
     $Output = '<style>table { font-size: small; border-style: solid; border-color: gray; border-width: 1px; border-collapse: collapse; }'.
'td { border-style: solid; border-color: gray; border-width: 1px; padding: 2px 5px 2px 5px; text-align: center;}'.
'th { border-style: solid; border-color: gray; border-width: 1px; padding: 2px 5px 2px 5px;}</style>';
    $this->FlushOutput($Output);
    if(array_key_exists('Action', $_GET))
    {
      if($_GET['Action'] == 'CheckRelations') $Output .= $this->CheckCorruptedRelations();
      else if($_GET['Action'] == 'DeleteRelations') $Output .= $this->DeleteCorruptedRelations();
      else if($_GET['Action'] == 'ShowRelations') $Output .= $this->ShowRelations();
      else if($_GET['Action'] == 'DeleteOldAccounts') $Output .= $this->DeleteOldAccounts();
      else $Output = 'Unknown action';
    } else
    {
      $Output = '<a href="?Action=ShowRelations">Show relations</a><br/>'.
        '<a href="?Action=CheckRelations">Check corrupted relations</a><br/>'.
        '<a href="?Action=DeleteRelations">Delete corrupted relations</a><br/>'.
        '<br/>';
      $Output .= '<form action="?Action=DeleteOldAccounts" method="post">'.
        '<fieldset><legend>Delete old accounts</legend>'.
        'Accounts older then <input name="months" value="12" /> months<br/>'.
        '<input type="submit" value="Delete" />'.
        '</fieldset></form>';
    }
    echo($Output); 
  }
}

$CleaningTool = new CleaningTool();
$CleaningTool->CharactersSchema = $CharactersSchema;
$CleaningTool->RealmdSchema = $RealmdSchema;
$CleaningTool->MangosSchema = $MangosSchema;
$CleaningTool->Relations = $ForeignKeys;
$CleaningTool->Database = new mysqli($HostName, $UserName, $Password);
$CleaningTool->Show();

?>

Soubor definition.php

<?php

$ForeignKeys = array(
  array(
    'SourceSchema' => $RealmdSchema, 
    'SourceTable' => 'uptime',
    'SourceColumn' => 'realmid', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'realmlist', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $RealmdSchema, 
    'SourceTable' => 'realmcharacters',
    'SourceColumn' => 'realmid', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'realmlist', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $RealmdSchema, 
    'SourceTable' => 'realmcharacters',
    'SourceColumn' => 'acctid', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'account', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $RealmdSchema, 
    'SourceTable' => 'account_banned',
    'SourceColumn' => 'id', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'account', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'account_data',
    'SourceColumn' => 'account', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'account', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'characters', 
    'SourceColumn' => 'account',
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'account', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_action', 
    'SourceColumn' => 'guid',
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_aura', 
    'SourceColumn' => 'guid',
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_declinedname', 
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_gifts', 
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_homebind', 
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_instance', 
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_inventory',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_inventory',
    'SourceColumn' => 'item_template', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'item_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_pet',
    'SourceColumn' => 'owner', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_queststatus',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_queststatus',
    'SourceColumn' => 'quest', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'quest_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_queststatus_daily',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_reputation',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_social',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_social',
    'SourceColumn' => 'friend', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_spell',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_spell_cooldown',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_spell_cooldown',
    'SourceColumn' => 'item', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'item_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_ticket',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_tutorial',
    'SourceColumn' => 'account', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'account', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_tutorial',
    'SourceColumn' => 'realmid', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'realmlist', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'corpse',
    'SourceColumn' => 'player', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'groups',
    'SourceColumn' => 'leaderGuid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'groups',
    'SourceColumn' => 'looterGuid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'group_instance',
    'SourceColumn' => 'leaderGuid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'group_instance',
    'SourceColumn' => 'instance', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'instance', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'group_member',
    'SourceColumn' => 'leaderGuid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'group_member',
    'SourceColumn' => 'memberGuid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild',
    'SourceColumn' => 'leaderGuid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_bank_item',
    'SourceColumn' => 'guildid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'guild', 
    'TargetColumn' => 'guildid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_bank_right',
    'SourceColumn' => 'guildid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'guild', 
    'TargetColumn' => 'guildid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_bank_tab',
    'SourceColumn' => 'guildid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'guild', 
    'TargetColumn' => 'guildid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_eventlog',
    'SourceColumn' => 'guildid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'guild', 
    'TargetColumn' => 'guildid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_member',
    'SourceColumn' => 'guildid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'guild', 
    'TargetColumn' => 'guildid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_member',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'guild_rank',
    'SourceColumn' => 'guildid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'guild', 
    'TargetColumn' => 'guildid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'arena_team',
    'SourceColumn' => 'captainguid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),  
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'arena_team_member',
    'SourceColumn' => 'arenateamid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'arena_team', 
    'TargetColumn' => 'arenateamid',
  ),  
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'arena_team_member',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),  
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'arena_team_stats',
    'SourceColumn' => 'arenateamid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'arena_team', 
    'TargetColumn' => 'arenateamid',
  ),  
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'auctionhouse',
    'SourceColumn' => 'auctioneerguid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),  
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'auctionhouse',
    'SourceColumn' => 'item_template', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'item_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_achievement',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),  
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'character_achievement_progress',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'item_instance',
    'SourceColumn' => 'owner_guid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'mail',
    'SourceColumn' => 'sender', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'mail',
    'SourceColumn' => 'receiver', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'mail_items',
    'SourceColumn' => 'mail_id', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'mail', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'mail_items',
    'SourceColumn' => 'receiver', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'mail_items',
    'SourceColumn' => 'item_template', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'item_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'petition',
    'SourceColumn' => 'ownerguid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'petition_sign',
    'SourceColumn' => 'ownerguid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'petition_sign',
    'SourceColumn' => 'petitionguid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'petition', 
    'TargetColumn' => 'petitionguid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'petition_sign',
    'SourceColumn' => 'playerguid', 
    'TargetSchema' => $CharactersSchema, 
    'TargetTable' => 'characters', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $CharactersSchema, 
    'SourceTable' => 'petition_sign',
    'SourceColumn' => 'player_account', 
    'TargetSchema' => $RealmdSchema, 
    'TargetTable' => 'account', 
    'TargetColumn' => 'id',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'page_text',
    'SourceColumn' => 'next_page', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'page_text', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'creature',
    'SourceColumn' => 'id', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'creature_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'game_event_creature',
    'SourceColumn' => 'event', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'game_event', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'game_event_creature',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'creature', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'game_event_creature_quest',
    'SourceColumn' => 'event', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'game_event', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'game_event_creature_quest',
    'SourceColumn' => 'quest', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'quest_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'game_event_gameobject',
    'SourceColumn' => 'event', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'game_event', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'game_event_gameobject',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'gameobject', 
    'TargetColumn' => 'guid',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'item_loot_template',
    'SourceColumn' => 'item', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'item_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'skinning_loot_template',
    'SourceColumn' => 'item', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'item_template', 
    'TargetColumn' => 'entry',
  ),
  array(
    'SourceSchema' => $MangosSchema, 
    'SourceTable' => 'creature_addon',
    'SourceColumn' => 'guid', 
    'TargetSchema' => $MangosSchema, 
    'TargetTable' => 'creature', 
    'TargetColumn' => 'guid',
  ),
);

?>

Související

Vnější odkazy