mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Now we aren't guessing check constraint names
but getting the real ones under MSSQL. MDL-9356
This commit is contained in:
parent
f0dfc20124
commit
92529a70fa
1 changed files with 12 additions and 5 deletions
|
@ -373,9 +373,16 @@ class XMLDBmssql extends XMLDBgenerator {
|
||||||
* (usually invoked from getModifyEnumSQL()
|
* (usually invoked from getModifyEnumSQL()
|
||||||
*/
|
*/
|
||||||
function getDropEnumSQL($xmldb_table, $xmldb_field) {
|
function getDropEnumSQL($xmldb_table, $xmldb_field) {
|
||||||
|
/// Let's introspect to know the real name of the check constraint
|
||||||
|
if ($check_constraints = $this->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) {
|
||||||
|
$check_constraint = array_shift($check_constraints); /// Get the 1st (should be only one)
|
||||||
|
$constraint_name = strtolower($check_constraint->name); /// Extract the REAL name
|
||||||
/// All we have to do is to drop the check constraint
|
/// All we have to do is to drop the check constraint
|
||||||
return array('ALTER TABLE ' . $this->getTableName($xmldb_table) .
|
return array('ALTER TABLE ' . $this->getTableName($xmldb_table) .
|
||||||
' DROP CONSTRAINT ' . $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'ck'));
|
' DROP CONSTRAINT ' . $constraint_name);
|
||||||
|
} else { /// Constraint not found. Nothing to do
|
||||||
|
return array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue