Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Creating Migrations with Floats ( v1.1 )
  • Hi guys,
    We are in the process of moving our current schema over to use Fuel Migrations, however, we are not quite sure how to create floats with numeric precision. We've tried, for example, field:float[11,2] but that just creates a column with a type of float. Any advice would be appreciated. Cheers,
    Darren
  • Interesting question. Oil seems to be able to accept only a single integer as field definition constraint - i.e.., fieldname:fieldtype[digits]. Anything else seems to not work as expected. Can anyone confirm that, before we put in a feature request?... On a side note: if you are using MySQL, the use of DECIMAL is usually preferable over FLOAT. From the MySQL docs:
    Because floating-point values are approximate and not stored as exact values, attempts to treat them as exact in comparisons may lead to problems. They are also subject to platform or implementation dependencies. For more information, see Section C.5.5.8, "Problems with Floating-Point Values". For maximum portability, code requiring storage of approximate numeric data values should use FLOAT or DOUBLE PRECISION with no specification of precision or number of digits. (...) The DECIMAL and NUMERIC types store exact numeric data values. These types are used when it is important to preserve exact precision, for example with monetary data.
  • fuel/oil now support floating point in 1.1/develop

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion