/**
  * Is the specified table in the specified schema renamed?
  * 
  * @param object $schema
  * @param object $table
  * return boolean
  */
 public static function is_renamed_table($schema, $table)
 {
     if (!is_object($schema)) {
         throw new exception("schema is not an object");
     }
     if (!is_object($table)) {
         throw new exception("table is not an object");
     }
     // command line switch sanity
     if (dbsteward::$ignore_oldnames) {
         throw new exception("dbsteward::ignore_oldname option is on, is_renamed_table() should not be getting called");
     }
     // if new_table['oldTableName'] is not defined, abort checks
     if (!isset($table['oldTableName'])) {
         return false;
     }
     // definition sanity checks
     if (format_schema::contains_table($schema, $table['oldTableName'])) {
         throw new Exception("oldTableName panic - new_schema " . $schema['name'] . " still contains table named " . $table['oldTableName']);
     }
     $old_schema = sql99_table::get_old_table_schema($schema, $table);
     if (!is_null($old_schema)) {
         if (!format_schema::contains_table($old_schema, $table['oldTableName'])) {
             throw new Exception("oldTableName panic - old_schema " . $old_schema['name'] . " does not contain table named " . $table['oldTableName']);
         }
     }
     // it is a new old named table rename if:
     // table['oldTableName'] exists in old schema
     // table['oldTableName'] does not exist in new schema
     if (format_schema::contains_table($old_schema, $table['oldTableName']) && !format_schema::contains_table($schema, $table['oldTableName'])) {
         dbsteward::info("NOTICE: " . $table['name'] . " used to be called " . $table['oldTableName']);
         return true;
     }
     return false;
 }
 /**
  * Creates new schemas (not the objects inside the schemas)
  *
  * @param  object  $ofs output file pointer
  * @return void
  */
 protected static function create_new_schemas($ofs)
 {
     foreach (dbx::get_schemas(dbsteward::$new_database) as $new_schema) {
         if (dbx::get_schema(dbsteward::$old_database, $new_schema['name']) == null) {
             dbsteward::info("Create New Schema " . $new_schema['name']);
             pgsql8::set_context_replica_set_id($new_schema);
             $ofs->write(format_schema::get_creation_sql($new_schema));
         }
     }
 }
 private static function drop_types($ofs, $old_schema, $new_schema)
 {
     if ($old_schema != NULL) {
         foreach (dbx::get_types($old_schema) as $type) {
             if (!format_schema::contains_type($new_schema, $type['name'])) {
                 $ofs->write(format_type::get_drop_sql($new_schema, $type) . "\n");
                 // $ofs->write(mysql5_type::get_type_demotion_sql($new_schema, $type));
             }
         }
     }
 }