[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 059.engines.php (source)

   1  <?php
   2  
   3  $conn = $schema_conn;
   4  
   5  $tables = queryfx_all(
   6    $conn,
   7    "SELECT TABLE_SCHEMA db, TABLE_NAME tbl
   8      FROM information_schema.TABLES s
   9      WHERE s.TABLE_SCHEMA LIKE %>
  10      AND s.TABLE_NAME != 'search_documentfield'
  11      AND s.ENGINE != 'InnoDB'",
  12      '{$NAMESPACE}_');
  13  
  14  if (!$tables) {
  15    return;
  16  }
  17  
  18  echo "There are ".count($tables)." tables using the MyISAM engine. These will ".
  19       "now be converted to InnoDB. This process may take a few minutes, please ".
  20       "be patient.\n";
  21  
  22  foreach ($tables as $table) {
  23    $name = $table['db'].'.'.$table['tbl'];
  24    echo "Converting {$name}...\n";
  25    queryfx(
  26      $conn,
  27      'ALTER TABLE %T.%T ENGINE=InnoDB',
  28      $table['db'],
  29      $table['tbl']);
  30  }
  31  echo "Done!\n";


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1