Skip to content

Schema:: normal or bug? #7298

Closed
Closed
@xeno010

Description

@xeno010

code is better than words

/**
* Setup: Laravel 5.0, MySQL driver
**/

// Step 1
Schema::table('test_abcd', function(Blueprint $table)
{
    // Create a double(8,2), not a float
    $table->float('float_test');

    // Create a double
    $table->double('double_test');
});

// Step 2
Schema::table('test_abcd', function(Blueprint $table)
{
   // FATAL Error, see log **1**
   $table->float('float_test', 6, 2)->change();

    // FATAL Error, too
    $table->double('double_test')->change();
});

Log 1

> php.exe X:\xxx\artisan migrate
exception 'Doctrine\DBAL\DBALException' with message 'Unknown column type "double(6, 2)" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.' in X:\xxx\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php:228
Stack trace:
#0 X:\xxx\vendor\doctrine\dbal\lib\Doctrine\DBAL\Types\Type.php(172): Doctrine\DBAL\DBALException::unknownColumnType('double(6, 2)')
#1 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php(361): Doctrine\DBAL\Types\Type::getType('double(6, 2)')
#2 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php(349): Illuminate\Database\Schema\Grammars\Grammar->getDoctrineColumnChangeOptions(Object(Illuminate\Support\Fluent))
#3 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php(319): Illuminate\Database\Schema\Grammars\Grammar->getDoctrineColumnForChange(Object(Doctrine\DBAL\Schema\Table), Object(Illuminate\Support\Fluent))
#4 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php(303): Illuminate\Database\Schema\Grammars\Grammar->getTableWithColumnChanges(Object(Illuminate\Database\Schema\Blueprint), Object(Doctrine\DBAL\Schema\Table))
#5 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php(282): Illuminate\Database\Schema\Grammars\Grammar->getChangedDiff(Object(Illuminate\Database\Schema\Blueprint), Object(Doctrine\DBAL\Schema\MySqlSchemaManager))
#6 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php(89): Illuminate\Database\Schema\Grammars\Grammar->compileChange(Object(Illuminate\Database\Schema\Blueprint), Object(Illuminate\Support\Fluent), Object(Illuminate\Database\MySqlConnection))
#7 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php(61): Illuminate\Database\Schema\Blueprint->toSql(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#8 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php(169): Illuminate\Database\Schema\Blueprint->build(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#9 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php(94): Illuminate\Database\Schema\Builder->build(Object(Illuminate\Database\Schema\Blueprint))
#10 X:\xxx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(213): Illuminate\Database\Schema\Builder->table('manufacturers', Object(Closure))
#11 X:\xxx\database\migrations\2015_02_06_112008_add_test2_to_manufacturers_table.php(19): Illuminate\Support\Facades\Facade::__callStatic('table', Array)
#12 X:\xxx\database\migrations\2015_02_06_112008_add_test2_to_manufacturers_table.php(19): Illuminate\Support\Facades\Schema::table('manufacturers', Object(Closure))
#13 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php(135): AddTest2ToManufacturersTable->up()
#14 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php(111): Illuminate\Database\Migrations\Migrator->runUp('2015_02_06_1120...', 3, false)
#15 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php(82): Illuminate\Database\Migrations\Migrator->runMigrationList(Array, false)
#16 X:\xxx\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\MigrateCommand.php(73): Illuminate\Database\Migrations\Migrator->run('X:\xxx...', false)
#17 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#18 X:\xxx\vendor\laravel\framework\src\Illuminate\Container\Container.php(523): call_user_func_array(Array, Array)
#19 X:\xxx\vendor\laravel\framework\src\Illuminate\Console\Command.php(115): Illuminate\Container\Container->call(Array)
#20 X:\xxx\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 X:\xxx\vendor\laravel\framework\src\Illuminate\Console\Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 X:\xxx\vendor\symfony\console\Symfony\Component\Console\Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 X:\xxx\vendor\symfony\console\Symfony\Component\Console\Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 X:\xxx\vendor\symfony\console\Symfony\Component\Console\Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 X:\xxx\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 X:\xxx\artisan(34): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 {main}

Process finished with exit code 1 at 12:26:41.
Execution time: 505 ms.

According to the documentation it should work

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