Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get doctrine to generate sql with BIGINT type?

In my schema I have a number of field that need to be BIGINT. I use the following command from Symfony

symfony doctrine:build-sql

to generate my database. The fields always come out as type int. I have tried the following types in the schema:

  • int
  • {type: integer, notnull: true}
  • {type: integer(5), notnull: true}
  • {type: bigint, notnull: true}

None of them seem to work (I always rebuild the model before building the SQL).

What type should i put in the schema.yml?

like image 690
jihi Avatar asked Nov 29 '22 16:11

jihi


1 Answers

With Symfony 2.x (e.g. Doctrine 2.4.1) and PHP annotations on Entities, using @ORM\Column(name="id", type="bigint") results in a MySQL bigint(20).

NB: OP tagged this question with symfony1 & doctrine1, for which this solution will not work.

like image 96
DavidJ Avatar answered Dec 04 '22 08:12

DavidJ