Adding a MySQL Index to a column/s using Symfony3 and XML

ORStudios

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

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Adding columns of different index

From Dev

Mysql not using an index on where in with two columns

From Dev

Mysql not using an index on where in with two columns

From Dev

MySQL Adding columns together

From Dev

MySQL Adding columns together

From Dev

using ckeditor in symfony3

From Dev

using ckeditor in symfony3

From Dev

Index of three columns in mySQL

From Dev

MySQL Index on multiple columns

From Dev

mysql-problems with adding columns

From Dev

VBA - Adding columns using find

From Dev

VBA - Adding columns using find

From Dev

Symfony3 - Using LEFT or RIGHT with doctrine

From Dev

Image not found using LiipImagineBundle and Symfony3

From Dev

MySQL - Unique index on multiple columns

From Dev

Symfony3 validate field only when adding object

From Dev

Clarification on MySQL 5.6 using IN PLACE alter table for adding/dropping the same index

From Dev

Clarification on MySQL 5.6 using IN PLACE alter table for adding/dropping the same index

From Dev

Undefined Index error in PHP while adding data to Mysql database using a HTML(Php) Form

From Dev

500: Internal Server Error undefined index Symfony3

From Java

Adding multiple columns AFTER a specific column in MySQL

From Dev

Mysql group by not using index

From Dev

Mysql not using index on where

From Dev

MYSQL Using Spatial Index

From Dev

MySQL Not Using the Best Index

From Dev

Adding multiple columns to a dataframe using lookup table

From Dev

Adding an index to an RDD using a shared mutable state

From Dev

Using query builder for adding fulltext index in Laravel

From Dev

r - Adding a row index based on a combination of multiple columns in a large dataframe

Related Related

HotTag

Archive