Skip to content

Instantly share code, notes, and snippets.

@mrimann
Created November 30, 2012 12:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrimann/4175455 to your computer and use it in GitHub Desktop.
Save mrimann/4175455 to your computer and use it in GitHub Desktop.
use TYPO3\Flow\Annotations as Flow;
use Doctrine\ORM\Mapping as ORM;
/**
* A User
*
* @Flow\Entity
*/
class User {
/**
* @var \TYPO3\Flow\Security\Account
* @ORM\ManyToOne
*/
protected $account;
@mrimann
Copy link
Author

mrimann commented Nov 30, 2012

Anyone a clue, why this causes the following error message when running ./flow doctrine:update ? (I tried deleting this user-table and also deleting all tables of that database - didn't help so far):

flow doctrine:update
Uncaught Exception
An exception occurred while executing 'ALTER TABLE
me_mypackage_domain_model_user ADD CONSTRAINT FK_F8FBC21D7D3656A4
FOREIGN KEY (account) REFERENCES typo3_flow_security_account
(persistence_object_identifier)':
SQLSTATE[HY000]: General error: 1005 Can't create table
'dev_mypackage.#sql-269_131d' (errno: 150)

@brgmn
Copy link

brgmn commented Nov 30, 2012

(errno: 150) means: "You want to add a contraint over two different field types (for exemple the fields have a different encoding or one is int(10) and the other int(11),...)

@mrimann
Copy link
Author

mrimann commented Nov 30, 2012

If someone stumbles upon this issue: It could be solved by deleting the table and re-creating it with utf-8 definition - then a doctrin:update ran through without any further problem.

See: https://twitter.com/brgmn/status/274243407197655040

@kdambekalns
Copy link

Since 2.3 Doctrine adds charset/collation information, overriding the default from the DB that was used before. If those do not match, it breaks. Recommended way around this: use migrations, rather than update and make sure the charset data matches (or remove it to use the DB default).

@kdambekalns
Copy link

Oh, and always remember: SHOW ENGINE INNODB STATUS is your best friend when you hit error 150…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment