[DATABASE][MariaDB] Fix index changes with foreign keys enabled

This commit is contained in:
Alexei Sorokin
2020-07-23 19:09:41 +03:00
committed by Diogo Peralta Cordeiro
parent 9ec1b667c0
commit 182f94cf6f
2 changed files with 35 additions and 1 deletions

View File

@@ -333,6 +333,21 @@ class MysqlSchema extends Schema
$statements[] = "CREATE FULLTEXT INDEX $name ON $table " . $this->buildIndexList($def);
}
/**
* Append an SQL statement with an index definition for an advisory
* index over one or more columns on a table.
*
* @param array $statements
* @param string $table
* @param string $name
* @param array $def
*/
public function appendCreateIndex(array &$statements, $table, $name, array $def)
{
$statements[] = "ALTER TABLE {$this->quoteIdentifier($table)} "
. "ADD INDEX {$name} {$this->buildIndexList($def)}";
}
/**
* Close out a 'create table' SQL statement.
*
@@ -456,7 +471,8 @@ class MysqlSchema extends Schema
*/
public function appendDropIndex(array &$statements, $table, $name)
{
$statements[] = "DROP INDEX {$name} ON {$this->quoteIdentifier($table)}";
$statements[] = "ALTER TABLE {$this->quoteIdentifier($table)} "
. "DROP INDEX {$name}";
}
private function isNumericType(array $cd): bool