Skip to content

Migration plan fails when using self defined Enum Types #14444

Open
@Musealali

Description

@Musealali

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

11.4.1

Bug summary

I am getting issues when running a migration plan to create a custom table
and I get this error because the migration plan has a hard time resolving my enum.

image

And looking at the NPoco (which Umbraco uses) release notes (documentation is really bad on this), you can either use integer or string values for enums, see: https://github.com/schotime/NPoco/wiki/Release-Notes#2109

So adding either [ColumnType(typeof(string))] or [ColumnType(typeof(int))] to the Status property should work but it doesn't within Umbraco..

Its related to this codebase:

https://github.com/umbraco/Umbraco-CMS/blob/fccbed125cebab8604d5832f32c8ee9ea1e123[…]o.Infrastructure/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs

Maybe its because it only knows about sql types?

And therefor it fails on a self defined type?

might be the case that NPoco does support enums, but our codebase does not..

That might also be the reason why we have all the ModelDto classes and are mapping them to the actual models

Specifics

No response

Steps to reproduce

To reproduce this issue please follow:

https://docs.umbraco.com/umbraco-cms/extending/database

And create a migration plan for your project.

One thing to remember is in your Model/Schema/Table - remember to add a self defined Enum

image

Expected result / actual result

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions