Try our conversational search powered by Generative AI!

MigrationStep won't execute because property already exists

Vote:
 

We have a block which used to have a property called "Title" that we've now renamed to "Heading" instead. We implemented this change and tested it and then figured that we should also add a migration to move the old title to the new property.

For this we created a miagration that inherited from MigrationStep like this.

public class HeroBlockRenameTitleToHeading : MigrationStep {
    public override void AddChanges() {
        ContentType("HeroBlock").Property("Heading").UsedToBeNamed("Title");
    }
}

But when we then start our project again this is logged.

[13:08:31 WRN] [] Page type model synchronizer couldn't save a property definition. A property with name "Heading" already exists

Not sure what to do here, of course it exists since the content type is generated from code. Also, if I change to another name in the migration (like"Header") it is run without problems but it doesn't create a new property so I'm not sure at all how to proceed here.

#293444
Edited, Dec 20, 2022 12:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.