Index is a reserved word in MySQL, so you can't use that as your table
name.

On Apr 16, 5:36 pm, Geoff G <geoffreyfish...@gmail.com> wrote:
> First, I'll give you the code upfront so you don't have to waste time
> asking:
>
> $ php app/console doctrine:schema:update --force
> Updating database schema...
>
>   [PDOException]
>
>   SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error
> in your S
> QL syntax; check the manual that corresponds to your MySQL server version
> for the rig
> ht syntax to use near 'Index (id INT AUTO_INCREMENT NOT NULL, profile_id INT
> DEFAULT
> NULL, url VARCHAR(' at line 1
>
> doctrine:schema:update [--complete] [--dump-sql] [--force] [--em[="..."]]
> $ php app/console doctrine:schema:update --dump-sql
> CREATE TABLE Index (id INT AUTO_INCREMENT NOT NULL, profile_id INT DEFAULT
> NULL, url
> VARCHAR(255) NOT NULL, text LONGTEXT NOT NULL, INDEX IDX_41B24805CCFA12B8
> (profile_id
> ), PRIMARY KEY(id)) ENGINE = InnoDB;
> CREATE TABLE Profile (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT
> NULL, url
>  VARCHAR(255) NOT NULL, regex VARCHAR(255) NOT NULL, PRIMARY KEY(id)) ENGINE
> = InnoDB
> ;
> ALTER TABLE Index ADD FOREIGN KEY (profile_id) REFERENCES Profile(id)
>
> <?php
> namespace TSEP\SearchBundle\Entity;
>
> /**
>  * @orm:Entity
>  */
> class Profile
> {
> /**
>  * @orm:Id
>  * @orm:Column(type="integer")
>  * @orm:GeneratedValue(strategy="AUTO")
>  */
>     protected $id;
>
>     /**
>      * @orm:Column(type="string", length="255")
>      */
>     protected $name;
>
>     /**
>      * @orm:Column(type="string", length="255")
>      */
>     protected $url;
>
> /**
>      * @orm:Column(type="string", length="255")
>      */
>     protected $regex;
>
>     /**
>      *@orm:OneToMany(targetEntity="Index", mappedBy="Profile")
>      */
>     protected $indices;
>
> }
>
> <?php
> namespace TSEP\SearchBundle\Entity;
>
> /**
>  * @orm:Entity
>  */
> class Index
> {
> /**
>  * @orm:Id
>  * @orm:Column(type="integer")
>  * @orm:GeneratedValue(strategy="AUTO")
>  */
>     protected $id;
>
>     /**
>      * @orm:Column(type="string", length="255")
>      */
>     protected $url;
>
>     /**
>      * @orm:Column(type="text")
>      */
>     protected $text;
>
>     /**
>      *@orm:ManyToOne(targetEntity="Profile", inversedBy="Index")
>      */
>     protected $profile;
>
> }
>
> # Doctrine Configuration
> doctrine:
>     dbal:
>         default_connection: default
>         connections:
>             default:
>                 driver:   %database_driver%
>                 host:     %database_host%
>                 dbname:   %database_name%
>                 user:     %database_user%
>                 password: %database_password%
>
>     orm:
>         auto_generate_proxy_classes: %kernel.debug%
>         default_entity_manager: default
>         entity_managers:
>             default:
>                 mappings:
>                     AcmeDemoBundle: ~
>                     TSEPSearchBundle: ~
>
> I can't update the schema as it instucts me to do in the manual. Any Ideas?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to