I am using laravel 6 and i had the following migration code
Schema::create('work_schedule_times', function (Blueprint $table) {
$table->time('start_time');
$table->time('end_time');
});
now i have to make changes in my new migrations to update time from timestamp. I have following code
Schema::table('employee_work_schedules', function (Blueprint $table) {
$table->timestamp('start_time')->change();
$table->timestamp('end_time')->nullable()->change();
});
}
when i run the migration i am getting following error
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.
Since laravel 9 is addressing this issue by giving following guidelines
If you plan to modify columns created using the timestamp method, you must also add the following configuration to your application's config/database.php configuration file:
use Illuminate\Database\DBAL\TimestampType;
'dbal' => [
'types' => [
'timestamp' => TimestampType::class,
],
],
since i am using laravel 6 and i am beginner i dont know how to fix this error since start_time must have timestamp datatype