[DBAL-289] Wrong diff between Oracle 'Date' type and Metadata 'Date' type Created: 30/May/12 Updated: 22/Aug/12 |
|
| Status: | Reopened |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Christian Stoller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Oracle Express 11g and doctrine-dbal 2.2.2 |
||
| Description |
|
Hi,
--dump-sql says: ALTER TABLE CONSIGNMENTS MODIFY (SDGDATE DATE DEFAULT NULL); The current table structure looks like that:
Mapping definition: /** * @ORM\Column(name="SDGDATE",type="date",nullable=true) */ private $sdgdate; I think there is a problem with the comparison between Oracles 'Date' type and the Metadata 'Date' type. I am used to use MySQL as DBMS but our customer uses Oracle. MySQL's 'datetime' and Oracle's 'date' type are store the same data. I am not sure what should be done here. Because this could lead to confusion for all Oracle user. Maybe there could be a request to the platform in the Schema Comparator here: public function diffColumn(Column $column1, Column $column2) { $changedProperties = array(); if ( $column1->getType() != $column2->getType() ) { $changedProperties[] = 'type'; } // ... } |
| Comments |
| Comment by Christian Stoller [ 30/May/12 ] |
|
When I put a breakpoint on the second line of the diffColumn method in my IDE and stop there during debugging I have those variable values: $this Doctrine\DBAL\Schema\Comparator $changedProperties array[0] $column1 Doctrine\DBAL\Schema\Column _type Doctrine\DBAL\Types\DateTimeType <-- datetime _precision integer 10 _scale integer 0 _unsigned boolean 0 _fixed boolean 0 _notnull boolean 0 _autoincrement boolean 0 _platformOptions array[0] _comment string "" _customSchemaOptions array[0] _name string "SDGDATE" _quoted boolean 0 $column2 Doctrine\DBAL\Schema\Column _type Doctrine\DBAL\Types\DateType <-- date _precision integer 0 _scale integer 0 _unsigned boolean 0 _fixed boolean 0 _notnull boolean 0 _autoincrement boolean 0 _platformOptions array[1] _customSchemaOptions array[0] _name string "SDGDATE" _quoted boolean 0 You see that there are different types. But it would be nice if the comparison would say: "Theay are equal - no diff" |
| Comment by Benjamin Eberlei [ 08/Jul/12 ] |
|
This issue can't be fixed. Doctrine has this type abstraction here which prevents a special case fix here. The solution in this case is obvious, set the type to "datetime" on Oracle. |
| Comment by Christian Stoller [ 22/Aug/12 ] |
|
Sorry, this issue commes up again.
Shipment:
type: entity
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
pickupDate:
type: date
column: pickup_date
pickupTimeFrom:
type: time
column: pickup_time_from
lifecycleCallbacks: { }
When I update my schema with the above YAML mapping, I always get the following error although I haven't changed anything at the mapping.
Okay, I could change the types to 'datetime', but what if I have to move to MySQL? I just want to store 'date' and 'time', not 'datetime'. |