只是一个简单的例子:如果我想创建的Postgres,支持自动填充ID的表我运行该SQL:Doctrine2 doesen't顺序设置为默认的ID列(Postgres的)
CREATE SEQUENCE person_id_seq START 1;
CREATE TABLE person (
id integer PRIMARY KEY DEFAULT nextval('person_id_seq'),
name varchar(100) NOT NULL
);
和我的学说将所有财产
class Person {
/**
* @Id
* @Column(type="integer", nullable=false)
* @GeneratedValue(strategy="SEQUENCE")
* @SequenceGenerator(sequenceName="person_id_seq", initialValue=1, allocationSize=100)
*/
private $id;
但是当我生成的SQL(PHP学说ORM:架构工具:创建--dump-SQL)我知道了:
CREATE TABLE person (
id INT NOT NULL,
name VARCHAR(100) NOT NULL
);
CREATE SEQUENCE person_id_seq INCREMENT BY 100 MINVALUE 1 START 1
但不要将其设置为默认
\ d人
Column | Type | Modifiers
-------------------+--------------------------------+-----------
id | integer | not null
...
..
.
对于新手;在github上存在一个与此问题相关的新PR:https://github.com/doctrine/dbal/pull/669 – edigu 2014-10-28 14:04:11