What is the syntax to set the auto increment start value in schema.yml with Doctrine?
I want to set the start value for auto increment on a column to 1000000 (to avoid conflicts with a legacy application), but can't find any document开发者_如何学编程ation that tells me how.
Pretty standard table, here's what the relevant bit looks like:
User:
attributes:
export: tables
columns:
id:
type: integer
primary: true
autoincrement: true
code:
type: string(6)
...
The best way to acomplish this would be the creation of a Doctrine Migration. There you are able to set the value of the sequence table to the value you want. Migrations are easy to use (http://www.doctrine-project.org/projects/orm/1.2/docs/manual/migrations/en#migrations) and you can run it during your deployment process of your application.
Here are some thoughts since there seems no other way.
Can you set the default value of id
to be 100000? I haven't tried this, but it might work.
Another option would be to have your install script insert a row with a id
value of 100000. If necessary, it could remove it as well. This would move the autoincrement up to 100000.
精彩评论