mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3089: Doctrine1 to Doctrine2 Oracle type float #3836
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 17, 2014).
Originally assigned to: @deeky666 on GitHub.
Jira issue originally created by user servietsky777:
I have a big problem migrating an application from Doctrine1 to Doctrine2.
The variable ROUNDNUMBER was set with Doctrine1 in the Oracle 10G database with the following schema :
ApprenticeYeartype:
columns:
id: {type: integer, notnull: true, primary: true, autoincrement: true}
name: {type: string(255), notnull: true}
roundNumber: {type: float, notnull: true}
The values stored in this variable are: 0.1 or 0.5 or 1.0
In Oracle, the data type was set as "NUMBER" with no precision or scale set. I found this "If
a precision is not specified, the column stores values as given. If no scale is
specified, the scale is zero. ".
So there should be no scale which is weird because it worked with the values 0.1, 0.5...
It worked nicely on Symfony1 and Doctrine1, but for the migration to Symfony2 and Doctrine2, I used the command to import the schema from the database "php app/console doctrine:mapping:convert"
The created schema's ROUNDNUMBER variable was set with the Doctrine2 type "Integer". So now I get the variable as an int and not float and so I can't use it.
I tried changing the type to decimal, float etc...
/****
*
*/
private $roundnumber;
But I keep getting this error :
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'ALTER TABLE APPRENTICE_YEARTYPE MODI
FY (ROUNDNUMBER DOUBLE PRECISION DEFAULT NULL)':
ORA-01440: column to be modified must be empty to decrease precision or sca
le
If anyone know a solution, please help me !
@doctrinebot commented on GitHub (Apr 17, 2014):
Comment created by @deeky666:
Looks like you create the column ROUNDNUMBER with an integer type mapping. Use "float" or "decimal" instead. When updating the schema please ensure that your ROUNDNUMBER column contains no data or at least all values in the column have to be NULL. See http://www.techonthenet.com/oracle/errors/ora01440.php
Please note that Doctrine's "float" maps to "DOUBLE PRECISION" and "decimal" to "NUMERIC(p,s)" on Oracle. See the DBAL types documentation for further information: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix
If you need further help, just drop me a line.
@doctrinebot commented on GitHub (Apr 17, 2014):
Comment created by @deeky666:
Not a Doctrine bug.
@doctrinebot commented on GitHub (Apr 17, 2014):
Issue was closed with resolution "Invalid"