Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel: Unknown column type "timestamp" requested

I am trying to perform a migration and I am getting the following problem.

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.

My code is the following:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Schema::table('XXXXXXXX', function (Blueprint $table) {
        $table->timestamp('start')->change();
        $table->timestamp('end')->change();
    });

The strange thing is that I have already performed migrations with that type of data:

Schema::create('XXXXXX', function (Blueprint $table) {
        ...
        $table->timestamp('date_expired')->nullable();
        ...

    });

Does anyone know how to fix it or see the error I’m doing.

Thanks


UPDATE

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)

>Solution :

On the laravel docs page you can find a warning telling you that there are certain types that you can’t use with the ->change() method.

Link to laravel docs

It also says this:

To modify a timestamp column type a Doctrine type must be registered.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading