Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.0.0-BETA4
-
Fix Version/s: 2.0.0-RC1-RC3
-
Component/s: Schema Managers
-
Labels:None
Description
The PostgreSQL database does not create indexes for foreign key columns, the user has to create them by hand. I think that indexes for foreign keys should be created automatically... On my system, an index will not be created automatically for the group_id column in the user table.
/**
* @Entity
*/
class User {
/**
* @ManyToOne(targetEntity="Group", inversedBy="users")
*/
protected $group;
}
/**
* @Entity
*/
class Group {
/**
* @OneToMany(targetEntity="User", mappedBy="group")
*/
protected $users;
public function __construct() {
$this->users = new \Doctrine\Common\Collections\ArrayCollection();
}
}
I am using current git clone and PgSQL 8.4.
I'd just like to add that there's an even worse problem with this – the indices are not created even for tables that Doctrine creates automatically – for example the joining tables...