Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 713 posts 951 karma points
    1 week ago
    Tom
    0

    Inconsistent dataTypeId's - Migration Issues

    Morning all! Hope everyone is safe and well.

    I've noticed that a data type record gets created in the cmsDataType table only once it is used for the first time.

    The reason I noticed this is that we run migrations via the api for creating properties on nodes.

    The issue we've found is that then when trying to migrate test and live the record doesn't exist until we manually add the data type to a property on a node but this creates inconsistent Id's so if we want to refer to the data type record by id it is inconsistent and fails migrations.

    I was wondering:

    1. Why is the data type not stored in the db until it is used the first time?
    2. How to do this successfully as I've tried to look up the property type id based on the data type name eg "Umbraco.MultipleTextstring" eg:

      var property = new PropertyType("Umbraco.MultipleTextstring", DataTypeDatabaseType.Ntext) { Alias = propertyAlias, Name = propertyName, Mandatory = mandatory, Description = description };

    Would it just be better to execute raw sql?

Please Sign in or register to post replies

Write your reply to:

Draft