LoginSignup
2
1

More than 5 years have passed since last update.

Laravelで、 `timestamp` 型はchange()できない

Posted at
  • Laravel 5.1
  • Doctrine 2.3

という環境。

Schema::table('users', function (Blueprint $table) {
   $table->timestamp('hogehoge')->create();
});

の後に

Schema::table('users', function (Blueprint $table) {
   $table->timestamp('hogehoge')->nullable()->change();
});

とすると、このような長いエラーを吐く。

  [Doctrine\DBAL\DBALException]                                                                             
  Unknown column type "timestamp" requested. Any Doctrine type that you use has to be registered with \Doc  
  trine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Ty  
  pe::getTypesMap(). If this error occurs during database introspection then you might have forgot to regi  
  ster 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 pr  
  oblem with the cache or forgot some mapping information.                                                  

Doctrineのエラーだから仕方ないとのこと。

DATETIME型にするしかないか。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1