fuel/oil — Issue #61: Migration Unable to Set Precision in DECIMAL Fields
Author: knudpotente
Created: 2011-11-06 21:49:25+00:00
State: open

When specifying fields of type DECIMAL or FLOAT, it is usually needed to pass 2 integers as constraints, in the format "M,P", where "M" sets the total number of digits to be stored in the column ("magnitude"), and "P" specifies how many out of those digits will be used for the decimal part of the number ("precision"). Therefore, a DECIMAL columns with constrains "6,2" would store numbers made up of 6 digits, where 2 of these are used for the decimal part - such as: "1234.56" or "9876.54." If a column of type DECIMAL is specified with no precision, it is assumed to have precision '0' - that is, to have no decimal part at all.

Currently, it seems that there is no way to specify a DECIMAL (or FLOAT) field appropriately, if created using oil.

What would be required is something like:

```
oil generate migration add_salary_to_employees salary:decimal[6,2]
```