Sequence generation for doctrine ORM and Migrations #112

Closed
jrjohnson opened this Issue Mar 2, 2013 · 2 comments

Projects

None yet

2 participants

@jrjohnson

I'm getting different results from doctrine ORM and doctrine migrations for creating auto incrementing id columns in oracle.

Migrations is missing the column name in the pattern {dbname}_{column}_seq. It looks like there are two different strategies for generating sequence names between ORM and DBAL/Platform/OraclePlatform.

Creating my entity in PHP annotations like:

/**
 * @Entity
 * @Table(name="types")
 * */
class Type
{

    /**
     * @Id
     * @Column(type="bigint")
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;
}

and running schema-tool:update --dump-sql results in:

CREATE SEQUENCE types_id_seq START WITH 1 MINVALUE 1 INCREMENT BY 1

doing this in doctrine migrations:

public function up(\Doctrine\DBAL\Schema\Schema $schema)
{
  $table = $schema->createTable('types');
  $table->addColumn('id', 'bigint', array('autoincrement' => true));
  $table->setPrimaryKey(array('id'), 'primary');
}

results in:

CREATE SEQUENCE TYPES_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
@mikeSimonson
Contributor

@jrjohnson Was your issue fixed by your PR #278 ?

@jrjohnson

Yes.

@jrjohnson jrjohnson closed this Feb 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment