src/db/Migration.php
public function findForeignKeys ($table, $column = null)
		{
			$query = ( new  Query )
				->select('CONSTRAINT_NAME')
				->from('INFORMATION_SCHEMA.KEY_COLUMN_USAGE')
				->where([
					'TABLE_SCHEMA' => $this->getDbName(),
					'TABLE_NAME'   => $table
				]);
			if (!is_null($column))
				$query->andWhere([ 'COLUMN_NAME' => $column ]);

			return $query->column();
		}
public function findForeignKeys ($table, $column = null)
		{
			$query = ( new  Query )
				->select('CONSTRAINT_NAME')
				->from('INFORMATION_SCHEMA.KEY_COLUMN_USAGE')
				->where([
					'TABLE_SCHEMA' => $this->getDbName(),
					'TABLE_NAME'   => $table
				]);
			if (!is_null($column))
				$query->andWhere([ 'COLUMN_NAME' => $column ]);

			return $query->column();
		}
public function findForeignKeys ( $ table , $ column = null ) { $ query = ( new Query ) -> select ( 'CONSTRAINT_NAME' ) -> from ( 'INFORMATION_SCHEMA.KEY_COLUMN_USAGE' ) -> where ( [ 'TABLE_SCHEMA' => $ this -> getDbName ( ) , 'TABLE_NAME' => $ table ] ) ; if ( ! is_null ( $ column ) ) $ query -> andWhere ( [ 'COLUMN_NAME' => $ column ] ) ; return $ query -> column ( ) ; }
Find all foreign keys names for specific table and column.

@param string      $table
@param string|null $column

@return string[]
Find all foreign keys names for specific table and column .