Laravel:请求的列类型 "timestamp" 未知
Laravel: Unknown column type "timestamp" requested
我正在尝试执行迁移,但遇到了以下问题。
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 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.
我的代码如下:
Schema::table('XXXXXXXX', function (Blueprint $table) {
$table->timestamp('start')->change();
$table->timestamp('end')->change();
});
奇怪的是我已经用那种类型的数据执行了迁移:
Schema::create('XXXXXX', function (Blueprint $table) {
...
$table->timestamp('date_expired')->nullable();
...
});
有谁知道如何修复它或看到我正在做的错误。
谢谢
更新
In the end I have deleted the migration, I have modified it putting timestamp in the necessary columns and I have executed it again. (Having deleted the table before from the database)
在 laravel 文档页面上,您可以找到一条警告,告诉您某些类型不能与 ->change()
方法一起使用。
它还说:
To modify a timestamp column type a Doctrine type must be registered.
我正在尝试执行迁移,但遇到了以下问题。
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 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.
我的代码如下:
Schema::table('XXXXXXXX', function (Blueprint $table) {
$table->timestamp('start')->change();
$table->timestamp('end')->change();
});
奇怪的是我已经用那种类型的数据执行了迁移:
Schema::create('XXXXXX', function (Blueprint $table) {
...
$table->timestamp('date_expired')->nullable();
...
});
有谁知道如何修复它或看到我正在做的错误。
谢谢
更新
In the end I have deleted the migration, I have modified it putting timestamp in the necessary columns and I have executed it again. (Having deleted the table before from the database)
在 laravel 文档页面上,您可以找到一条警告,告诉您某些类型不能与 ->change()
方法一起使用。
它还说:
To modify a timestamp column type a Doctrine type must be registered.