public static function diff_constraints_table($ofs, $old_schema, $old_table, $new_schema, $new_table, $type, $drop_constraints = false)
 {
     if ($drop_constraints) {
         // drop constraints that no longer exist or are modified
         $old_constraints = static::get_drop_constraints($old_schema, $old_table, $new_schema, $new_table, $type);
         if (count($old_constraints) > 0) {
             $ofs->write(static::get_multiple_drop_sql($old_schema, $old_table, $old_constraints));
         }
     } else {
         if (dbsteward::$old_database != NULL) {
             list($old_schema, $old_table) = dbx::find_old_table(dbsteward::$old_database, $new_schema, $new_table);
         }
         if ($old_schema === NULL || $old_table === NULL) {
             $new_constraints = format_constraint::get_table_constraints(dbsteward::$new_database, $new_schema, $new_table, $type);
         } else {
             $new_constraints = static::get_new_constraints($old_schema, $old_table, $new_schema, $new_table, $type);
         }
         $bits = self::get_multiple_create_bits($new_schema, $new_table, $new_constraints);
         if ($type == 'primaryKey') {
             $index_bits = mysql5_diff_indexes::diff_indexes_table_bits($old_schema, $old_table, $new_schema, $new_table);
             $bits = array_merge($index_bits, $bits);
         }
         // add new constraints
         if (count($bits) > 0) {
             $table = mysql5::get_fully_qualified_table_name($new_schema['name'], $new_table['name']);
             $ofs->write("ALTER TABLE {$table}\n  " . implode(",\n  ", $bits) . ";\n");
         }
     }
 }
 public static function diff_constraints_table($ofs, $old_schema, $old_table, $new_schema, $new_table, $type, $drop_constraints = false)
 {
     if ($drop_constraints) {
         // drop constraints that no longer exist or are modified
         $old_constraints = static::get_drop_constraints($old_schema, $old_table, $new_schema, $new_table, $type);
         if (count($old_constraints) > 0) {
             $ofs->write(static::get_multiple_drop_sql($old_schema, $old_table, $old_constraints));
         }
     } else {
         if (dbsteward::$old_database != NULL) {
             list($old_schema, $old_table) = dbx::find_old_table(dbsteward::$old_database, $new_schema, $new_table);
         }
         if ($old_schema === NULL || $old_table === NULL) {
             $new_constraints = format_constraint::get_table_constraints(dbsteward::$new_database, $new_schema, $new_table, $type);
         } else {
             $new_constraints = static::get_new_constraints($old_schema, $old_table, $new_schema, $new_table, $type);
         }
         // add new constraints
         if (count($new_constraints) > 0) {
             $ofs->write(static::get_multiple_create_sql($new_schema, $new_table, $new_constraints));
         }
     }
 }