public function addForeignKey(string $fieldName = '', string $tableName = '', string $tableField = '', string $onUpdate = '', string $onDelete = '')
	{
		if (! isset($this->fields[$fieldName]))
		{
			throw new DatabaseException(lang('Database.fieldNotExists', [$fieldName]));
		}

		$this->foreignKeys[$fieldName] = [
			'table'    => $tableName,
			'field'    => $tableField,
			'onDelete' => strtoupper($onDelete),
			'onUpdate' => strtoupper($onUpdate),
		];

		return $this;
	}
public function addForeignKey(string $fieldName = '', string $tableName = '', string $tableField = '', string $onUpdate = '', string $onDelete = '')
	{
		if (! isset($this->fields[$fieldName]))
		{
			throw new DatabaseException(lang('Database.fieldNotExists', [$fieldName]));
		}

		$this->foreignKeys[$fieldName] = [
			'table'    => $tableName,
			'field'    => $tableField,
			'onDelete' => strtoupper($onDelete),
			'onUpdate' => strtoupper($onUpdate),
		];

		return $this;
	}
public function addForeignKey ( string $ fieldName = '' , string $ tableName = '' , string $ tableField = '' , string $ onUpdate = '' , string $ onDelete = '' ) { if ( ! isset ( $ this -> fields [ $ fieldName ] ) ) { throw new DatabaseException ( lang ( 'Database.fieldNotExists' , [ $ fieldName ] ) ) ; } $ this -> foreignKeys [ $ fieldName ] = [ 'table' => $ tableName , 'field' => $ tableField , 'onDelete' => strtoupper ( $ onDelete ) , 'onUpdate' => strtoupper ( $ onUpdate ) , ] ; return $ this ; }
Add Foreign Key

@param string  $fieldName
@param string  $tableName
@param string  $tableField
@param string  $onUpdate
@param string  $onDelete

@return \CodeIgniter\Database\Forge
@throws \CodeIgniter\Database\Exceptions\DatabaseException
Add Foreign Key