Skip to content

[bug] migration 'float' function generated a 'double' type. #9103

Closed
@PaoJiao

Description

@PaoJiao

im trying to add a type of 'float' field to a user table using 'float()' functoin.
but i got a type of 'double' field instead of 'float' after 'php artisan migrate' command.

here is my migration file:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UserAlter extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('user', function(Blueprint $table)
        {
            $table->float('asdf')->after('tt')->unsigned()->index();
            //the 'asdf' field should be 'float' type, but it is double... so weird
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('user', function(Blueprint $table)
        {
            $table->dropColumn('asdf');
        });
    }

}

v4.2 is normal...

4.2 vs 5.0

https://github.com/laravel/framework/blob/4.2/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L389

protected function typeFloat(Fluent $column)
{
    return "float({$column->total}, {$column->places})";
}

https://github.com/laravel/framework/blob/5.0/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L389

protected function typeFloat(Fluent $column)
{
    return $this->typeDouble($column);
}

is it a bug? plz fix it...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions