"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/db/mysql/Schema.php" between
yii2-2.0.36.tar.gz and yii2-2.0.37.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

Schema.php  (yii2-2.0.36):Schema.php  (yii2-2.0.37)
skipping to change at line 372 skipping to change at line 372
/** /**
* Collects the foreign key column details for the given table. * Collects the foreign key column details for the given table.
* @param TableSchema $table the table metadata * @param TableSchema $table the table metadata
* @throws \Exception * @throws \Exception
*/ */
protected function findConstraints($table) protected function findConstraints($table)
{ {
$sql = <<<'SQL' $sql = <<<'SQL'
SELECT SELECT
kcu.constraint_name, `kcu`.`CONSTRAINT_NAME` AS `constraint_name`,
kcu.column_name, `kcu`.`COLUMN_NAME` AS `column_name`,
kcu.referenced_table_name, `kcu`.`REFERENCED_TABLE_NAME` AS `referenced_table_name`,
kcu.referenced_column_name `kcu`.`REFERENCED_COLUMN_NAME` AS `referenced_column_name`
FROM information_schema.referential_constraints AS rc FROM `information_schema`.`REFERENTIAL_CONSTRAINTS` AS `rc`
JOIN information_schema.key_column_usage AS kcu ON JOIN `information_schema`.`KEY_COLUMN_USAGE` AS `kcu` ON
( (
kcu.constraint_catalog = rc.constraint_catalog OR `kcu`.`CONSTRAINT_CATALOG` = `rc`.`CONSTRAINT_CATALOG` OR
(kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL) (`kcu`.`CONSTRAINT_CATALOG` IS NULL AND `rc`.`CONSTRAINT_CATALOG` IS NUL
L)
) AND ) AND
kcu.constraint_schema = rc.constraint_schema AND `kcu`.`CONSTRAINT_SCHEMA` = `rc`.`CONSTRAINT_SCHEMA` AND
kcu.constraint_name = rc.constraint_name `kcu`.`CONSTRAINT_NAME` = `rc`.`CONSTRAINT_NAME`
WHERE rc.constraint_schema = database() AND kcu.table_schema = database() WHERE `rc`.`CONSTRAINT_SCHEMA` = database() AND `kcu`.`TABLE_SCHEMA` = database(
AND rc.table_name = :tableName AND kcu.table_name = :tableName1 )
AND `rc`.`TABLE_NAME` = :tableName AND `kcu`.`TABLE_NAME` = :tableName1
SQL; SQL;
try { try {
$rows = $this->db->createCommand($sql, [':tableName' => $table->name , ':tableName1' => $table->name])->queryAll(); $rows = $this->db->createCommand($sql, [':tableName' => $table->name , ':tableName1' => $table->name])->queryAll();
$constraints = []; $constraints = [];
foreach ($rows as $row) { foreach ($rows as $row) {
$constraints[$row['constraint_name']]['referenced_table_name'] = $row['referenced_table_name']; $constraints[$row['constraint_name']]['referenced_table_name'] = $row['referenced_table_name'];
$constraints[$row['constraint_name']]['columns'][$row['column_na me']] = $row['referenced_column_name']; $constraints[$row['constraint_name']]['columns'][$row['column_na me']] = $row['referenced_column_name'];
} }
 End of changes. 3 change blocks. 
12 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)