I have the following XML file in Symfony3 and I would like to add a MYSQL index to the column videoPublisherDate
as I will be querying it quite a bit and ordering based upon it. I can add it manually via PHPMYADMIN but I was wondering how a can update the xml below so that it can be done automatically.
Thanks
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="AppBundle\Entity\Videos" table="videos">
<unique-constraints>
<unique-constraint columns="video_id" name="search_idx_videos" />
</unique-constraints>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="videoSource" type="text" column="video_source" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoId" type="string" column="video_id" length="50" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoTitle" type="text" column="video_title" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoImage" type="text" column="video_image" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoPublisher" type="text" column="video_publisher" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoPublisherId" type="text" column="video_publisher_id" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoPublisherDate" type="text" column="video_publisher_date" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="videoLength" type="integer" column="video_length" nullable="false">
<options>
<option name="unsigned"/>
</options>
</field>
<field name="videoActive" type="integer" column="video_active" nullable="false">
<options>
<option name="unsigned"/>
<option name="default">1</option>
</options>
</field>
<field name="videoTags" type="text" column="video_tags" length="65535" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
</entity>
</doctrine-mapping>
You can add your indexes in the xml definition, just like you do with your unique constraints:
<indexes>
<index name="name_videoPublisherDate" columns="video_publisher_date"/>
</indexes>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments