//end foreach
 pre_echo('Rebuilding Indexes');
 foreach ($info['tables'] as $tablename => $table_info) {
     if (!empty($table_info['indexes'])) {
         foreach ($table_info['indexes'] as $index_col => $index_info) {
             printName('Creating index sq_' . $tablename . '_' . $index_info['name']);
             $sql = create_index_sql($tablename, $index_info['columns'], $index_info['name'], $index_info['type']);
             $ok = MatrixDAL::executeSql($sql);
             if ($ok === false) {
                 printUpdateStatus('Failure, unable to run query: ' . $sql);
                 exit;
             }
             printUpdateStatus('OK');
             if ($table_info['rollback']) {
                 printName('Creating index sq_rb_' . $tablename . '_' . $index_info['name']);
                 $sql = create_index_sql('rb_' . $tablename, $index_info['columns'], $index_info['name'], $index_info['type']);
                 $ok = MatrixDAL::executeSql($sql);
                 if ($ok === false) {
                     printUpdateStatus('Failure, unable to run query: ' . $sql);
                     exit;
                 }
                 printUpdateStatus('OK');
             }
         }
         // end foreach
     }
     //end if
 }
 pre_echo('Rebuilding Sequences');
 foreach ($info['sequences'] as $sequence) {
     $new_seq_start = $sequence_values[$sequence];
 //end if
 if (!empty($table_info['unique_key'])) {
     foreach ($tables as $tablename) {
         $tablename = 'sq_' . $tablename;
         $idx_columns = $table_info['unique_key'];
         if (substr($tablename, 3, 3) == 'rb_') {
             array_unshift($idx_columns, 'sq_eff_from');
         }
         /**
          * Indexes are named after the tablename _ first_col _key
          * eg
          * "sq_rb_ast_lnk_sq_eff_from_key" => (sq_eff_from, minorid, majorid, link_type, value)
          */
         $full_idx_name = $tablename . '_' . $idx_columns[0] . '_key';
         printName('Checking for index ' . $full_idx_name);
         $create_index_statement = create_index_sql($tablename, $idx_columns, $full_idx_name, NULL, false, true);
         $error = true;
         if (isset($full_index_list[$tablename][$full_idx_name])) {
             $error = false;
         } else {
             /**
              * Oracle has different semantics.
              * You can have unnamed keys, in which case it gives it a random name.
              * Eg 'sys_c0013508'
              * So we have to basically trawl through "unnamed" keys to see if they match.
              */
             $temp_idx_cols = implode(',', $idx_columns);
             if (in_array($temp_idx_cols, $full_index_list[$tablename])) {
                 $full_idx_name = array_search($temp_idx_cols, $full_index_list[$tablename]);
                 $error = false;
             }