2017-10-30 6 views
1

私はSymfony3で次のXMLファイルを持っています。私はそれをかなりクエリして並べ替えるので、MYSQLインデックスをカラムvideoPublisherDateに追加したいと思いますそれ。私は手動でPHPMYADMIN経由で追加することができますが、私はどのように自動的に行うことができるようにXMLを下に更新することができますかと思っていた。Symfony3とXMLを使ってカラムにMySQLインデックスを追加する

おかげ

<?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> 

答えて

1

あなたのユニーク制約にあなたはあなたが同じように、XML定義であなたのインデックスを追加することができます

<indexes> 
    <index name="name_videoPublisherDate" columns="video_publisher_date"/> 
</indexes> 
関連する問題