<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeCreatedAtToSaleTaskOrdersTable extends Migration
{
/**
- Run the migrations.
- @return void
*/
public function up()
{
Schema::table('sale_task_orders', function (Blueprint $table) {
$table->timestamp('created_at')->nullable()->index()->change();
});
}
}
用这个方式增加索引竟然会抛出异常
$ php artisan migrate
Doctrine\DBAL\DBALException : Unknown column type "timestamp" 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 forgotten to register all database types for a Doctrine Type. Use Ab
stractPlatform#registerDoctrineTypeMapping() or have your custom types implement
Type#getMappedDatabaseTypes(). If the type name is empty you might have a probl
em with the cache or forgot some mapping information.
at C:\wamp64\www\youyu\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.ph
p:283
279| @return \Doctrine\DBAL\DBALException
280| /
281| public static function unknownColumnType($name)
282| {
283| return new self('Unknown column type "'.$name.'" requested. Any
Doctrine type that you use has ' .
284| 'to be registered with \Doctrine\DBAL\Types\Type::addType()
. You can get a list of all the ' .
285| 'known types with \Doctrine\DBAL\Types\Type::getTypesMap().
If this error occurs during database ' .
286| 'introspection then you might have forgotten to register al
l database types for a Doctrine Type. Use ' .
287| 'AbstractPlatform#registerDoctrineTypeMapping() or have you
r custom types implement ' .
Exception trace:
1 Doctrine\DBAL\DBALException::unknownColumnType("timestamp")
C:\wamp64\www\youyu\vendor\doctrine\dbal\lib\Doctrine\DBAL\Types\Type.php:
189
2 Doctrine\DBAL\Types\Type::getType("timestamp")
C:\wamp64\www\youyu\vendor\laravel\framework\src\Illuminate\Database\Schem
a\Grammars\ChangeColumn.php:150
Please use the argument -v to see more details.
推荐文章: