Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.0-RC1-RC3
-
Fix Version/s: 2.0-RC4
-
Component/s: Schema Managers
-
Labels:None
-
Environment:Oracle - Oci8
Description
When I have a boolean column(s) in my entities and I want to update schema with schema tool, I get an exception:
My entity:
/** @Entity @Table(name='st_node') */
class Node
{
/** @Id @Column(type="integer") @GeneratedValue */
protected $id;
/** @Column(type="string", length="255") */
protected $title;
/** @Column(type="boolean", nullable=false) */
protected $is_published;
/** @Column(type="boolean") */
protected $is_sticky;
/** @Column(type="integer", length=4) */
protected $hits;
/** @Column(type="decimal", precision=4, scale=2) */
protected $score;
}
./doctrine orm:schema-tool:update --force
Entities\Address
Entities\Node
Entities\Article
Entities\User
Entities\Page
Updating database schema...
[Doctrine\DBAL\Driver\OCI8\OCI8Exception]
ORA-01442: column to be modified to NOT NULL is already NOT NULL
The same with --dump-sql option:
./doctrine orm:schema-tool:update --dump-sql Entities\Address Entities\Node Entities\Article Entities\User Entities\Page ALTER TABLE ST_NODE MODIFY (is_published NUMBER(1) NOT NULL, is_sticky NUMBER(1) NOT NULL)
The columns are already not nulls, but schema-tool can't recognize that.
This is the DQL of the table:
CREATE TABLE "DOCTRINE"."ST_NODE" ( "ID" NUMBER(10,0) NOT NULL ENABLE, "TITLE" VARCHAR2(255 BYTE) NOT NULL ENABLE, "DISCR" VARCHAR2(255 BYTE) NOT NULL ENABLE, "IS_PUBLISHED" NUMBER(1,0) NOT NULL ENABLE, "HITS" NUMBER(10,0) NOT NULL ENABLE, "SCORE" NUMBER(4,2) NOT NULL ENABLE, "IS_STICKY" NUMBER(1,0) NOT NULL ENABLE, PRIMARY KEY ("ID") );
Fixed in https://github.com/milokmet/dbal/commits/DBAL-67