laravel/framework — pull request #2094 by apotheos (2013-08-13 20:59:58+00:00)
Title: [Pull Request] Support for double data type in schema builder.

I am implementing the feature discussed in issue #1955. This patch extends the Schema Builder syntax to include double support for columns. This means the following syntax is possible:

```php
Schema::create('table', function($table) {
$table->increments('id');
$table->double('double_col_1');
$table->double('double_col_2', 15, 8);
});
```

You'll notice there are two different ways to declare a double, with a specified precision or without. In addition to the simple double syntax, MySQL supports a second, nonstandard syntax.

From MySQL documentation:

> MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, “(M,D)” means than values can be stored with up to M digits in total, of which D digits may be after the decimal point. For example, a column defined as FLOAT(7,4) will look like -999.9999 when displayed. MySQL performs rounding when storing values, so if you insert 999.00009 into a FLOAT(7,4) column, the approximate result is 999.0001.

Both of these syntaxes are supported in this patch, as you'll see in the examples below. It is important to support both syntaxes because documentation for the default `M,D` in the extended syntax [is surprisingly nonspecific](http://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html), and those of use working on systems that already make use of the standard syntax might have lose precision migrating to the extended `M,D` notation.

Examples
---------------

Standard SQL DOUBLE syntax in MySQL is:

```php
$table->double('double_col_1');
```

Which is translated into:

```
alter table `table` add `double_col_1` double not null
```

And the nonstandard MySQL DOUBLE syntax option expressed as:

```php
$table->double('double_col_2', 15, 8);
```

Which is translated into:

```
alter table `table` add `double_col_2` double(15, 8) not null
```