I have two columns representing a start date and an end date. If I wanted to create a joint index for them, I would do:
* @Table(name="concerts", indexes={@Index(name="concert_dates", columns={"date_start","date_end"})})
But how would I do an index for each of them ? Is the following way correct?
* @Table(name="concerts", indexes={@Index(name="concert_date_start", columns={"date_start"}), @Index(name="concert_date_end", columns={"date_end"})})
Documentation says that indexes
is an array of @Index
annotations. So I'd say yes, it is correct.
Yes it works fine for me. I have done this:
/**
* Class ProductDisplayArea
* @ORM\Entity
* @ORM\Table(name="product_display_area", indexes={
* @Index(name="product_display_area_product_id", columns={"product_id"}),
* @Index(name="product_display_area_productCat_id", columns={"productCat_id"}),
* @Index(name="product_display_area_productSCat_id", columns={"productSCat_id"}),
* @Index(name="product_display_area_productSSCat_id", columns={"productSSCat_id"})
* })
* @ORM\HasLifecycleCallbacks()
* @ORM\Entity(repositoryClass="Admin\AdminBundle\Entity\ProductDisplayAreaRepository")
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With