/** * 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 */ protected 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 (mssql10_constraint::get_table_constraints(dbsteward::$new_database, $new_schema, $new_table, $type) as $constraint) { $list[] = $constraint; } } else { foreach (mssql10_constraint::get_table_constraints(dbsteward::$new_database, $new_schema, $new_table, $type) as $constraint) { $old_constraint = mssql10_constraint::get_table_constraint(dbsteward::$old_database, $old_schema, $old_table, $constraint['name']); if (!mssql10_table::contains_constraint(dbsteward::$old_database, $old_schema, $old_table, $constraint['name']) || !mssql10_table::constraint_equals($old_constraint, $constraint)) { $list[] = $constraint; } } } } return $list; }