/**
  * Returns list of constraints that should be added.
  *
  * @param old_table original table
  * @param new_table new table
  * @param type whether primary keys should be processed or other constraints should be processed
  *
  * @return list of constraints that should be added
  */
 private static function get_new_constraints($old_schema, $old_table, $new_schema, $new_table, $type)
 {
     $list = array();
     if ($new_table != null) {
         if ($old_table == null) {
             foreach (pgsql8_constraint::get_table_constraints(dbsteward::$new_database, $new_schema, $new_table, $type) as $constraint) {
                 $list[] = $constraint;
             }
         } else {
             foreach (pgsql8_constraint::get_table_constraints(dbsteward::$new_database, $new_schema, $new_table, $type) as $constraint) {
                 $old_constraint = pgsql8_constraint::get_table_constraint(dbsteward::$old_database, $old_schema, $old_table, $constraint['name']);
                 if (!pgsql8_table::contains_constraint(dbsteward::$old_database, $old_schema, $old_table, $constraint['name']) || !pgsql8_table::constraint_equals($old_constraint, $constraint) || pgsql8_table::constraint_depends_on_renamed_table(dbsteward::$new_database, $constraint)) {
                     $list[] = $constraint;
                 }
             }
         }
     }
     return $list;
 }