[FLOW3-general] doctrine:update error
"Christian Müller (FLOW3 Team)"
christian.mueller at typo3.org
Fri Aug 10 13:31:00 CEST 2012
Hi,
I never used the the column definition like that, you should be better
off using the annotation to get a doctrine managed generated value:
http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/annotations-reference.html#generatedvalue
Maybe the update script chokes on this kind of definition because it
can't be detected easily. It might work better if you used migrations
instead of direct updates.
Cheer,
Christian
On 10/08/12 10:57, Wasko Jugovic wrote:
> Hi,
>
> I need a table with an auto-incrementing column "idnr".
> When I do doctrine:update for the very first time this table is created:
>
> `flow3_persistence_identifier` VARCHAR(40) NOT NULL,
> `account` VARCHAR(40) NULL DEFAULT NULL,
> `idnr` INT(11) NOT NULL AUTO_INCREMENT
> .....
>
> But if I do now doctrine:update and the table already exists in database,
> I get this error:
>
> Uncaught Exception
> 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
>
> "idnr" is defined as key automatically and it's the only auto column. So
> what's wrong?
>
>
> This is my model:
>
> /**
> * A Customer
> *
> * @FLOW3\Entity
> * @ORM\Table(name="customer")
> */
> class Customer {
>
> /**
> * The Customers's account
> * @var \TYPO3\FLOW3\Security\Account
> * @ORM\OneToOne(cascade={"all"})
> */
> protected $account;
>
> /**
> * The idnr
> * @var integer
> * @ORM\Column(columnDefinition="INT(11) NOT NULL AUTO_INCREMENT UNIQUE")
> */
> protected $idnr;
>
> ............
>
>
>
More information about the FLOW3-general
mailing list