Ahh, this problem arises when you already have a primary key in the table and 
try to add an auto-incremented column. A workaround would be to drop the 
existing primary key first.

I suggest you take a look at Doctrine Migrations [1].

- Use the "migrations:diff" command which will generate a new migration-version 
containing the sql that would be performed by "orm:schema-tool:update".
- Change the SQL statements in that migration-version to fix your problem.
- Run the migration-version.

Once the migration-version functions correctly, it can be safely used on other 
databases (other developers, production, etc).

[1]: http://www.doctrine-project.org/projects/migrations.html

-- 
Jasper N. Brouwer
(@jaspernbrouwer)


On 5 Mar 2014, at 01:59, janul <[email protected]> wrote:

> hi,
> Thanks for you reply:
> 
> This what I get:
> --------------------    
>                                                                               
>                                                                               
>              
>   [Doctrine\DBAL\DBALException]                                               
>                                                                               
>                  
>   An exception occurred while executing 'ALTER TABLE group_members ADD id INT 
> AUTO_INCREMENT NOT NULL, ADD joinstate INT NOT NULL, ADD isdisabled 
> TINYINT(1) NOT NULL,   
>   ADD isbanned TINYINT(1) NOT NULL':                                          
>                                                                               
>                   
>                                                                               
>                                                                               
>                   
>   SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table 
> definition; there can be only one auto column and it must be defined as a key 
>                       
>   -------------------
> I use mysql..
> in entity definition I have also added:
> @Table(name="group_members", 
> uniqueConstraints={@UniqueConstraint(name="memberspair_idx", 
> columns={"user_id", "group_id"})})
> 
> Thanks in advance.
> -- 
> Jnl

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to