Pomelo.entityframeworkcore.mysql: Pomelo can't process some of MySQL column types

Created on 26 Mar 2017  路  8Comments  路  Source: PomeloFoundation/Pomelo.EntityFrameworkCore.MySql

Steps to reproduce

Use MySQL DB "Sakila".

I'm new to MySQL development and .NET Core techniques, so I'm trying to scaffold Entity Data Model from existing DB. Here's the code I'm running (from powershell, nuget console doesn't work btw):

dotnet ef dbcontext scaffold "user id=alex;host=localhost;database=sakila;persistsecurityinfo=True" "Pomelo.EntityFrameworkCore.MySql"

The issue

The output from the above command works without errors but I see this:

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:01.42
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'actor.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'address.location' with data type 'geometry'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'address.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[9]
Unable to scaffold the index 'idx_location'. The following columns could not be scaffolded: location.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'category.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'city.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'country.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'customer.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'film.release_year' with data type 'year(4)'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'film.rating' with data type 'enum('G','PG','PG-13','R','NC-17')'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'film.special_features' with data type 'set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes')'. Skipping column
.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'film.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'film_actor.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'film_category.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'inventory.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'language.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'payment.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'rental.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'staff.last_update' with data type 'timestamp'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'store.last_update' with data type 'timestamp'. Skipping column.

Further technical details

MySQL version: 5.7
Operating system: Windows 10 Pro x64 Anniversary Update
Pomelo.EntityFrameworkCore.MySql version: 1.1.1-*

Other details about my project setup: Just a simple .NET Core 1.1 Console app

Most helpful comment

Is there a way to define your own custom mapper? I don't have the option of changing the datatype in the database.

All 8 comments

What about it? I've encountered is the following problem.
Could not find type mapping for column 'course_taxonomy.open_on' with data type 'date'. Skipping column.
warn: Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory[6]
Could not find type mapping for column 'course_taxonomy.open_on' with data type 'date'. Skipping column.

Should I change all date type column to datetime?

Mappings are defined in MySqlTypeMapper and since date isn't defined you'll need to use datetime.

Is there a way to define your own custom mapper? I don't have the option of changing the datatype in the database.

I got this error to for timestamp and for enums in database. Is there a way to fix that problem?

I assume date MySQL column type should be DateTime .Net type
Or is there some way to customize mapper?

I have a same issue, but I can't change the database, because this belong another. How I can to fix this issue?

+1

I have the similar issue to the Point database type.

Could anyone help please?

Was this page helpful?
0 / 5 - 0 ratings