+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Extend Data Model: Modifications to Existing Custom Type

Extend Data Model: Modifications to Existing Custom Type

1 posts, 0 answered
  1. Brandon
    Brandon avatar
    0 posts
    Registered:
    28 Sep 2015
    17 Nov
    Link to this post

    I have followed the directions for extending the data model by setting up a custom type: http://docs.sitefinity.com/tutorial-extend-sitefinity-s-data-model

    I was able to successfully setup my type... however, the documentation doesn't cover a few topics:

    1. How to remove a prior attempt at type setup and re-run the  DB changes?
    Based upon my research... drop the type's table and delete the provider from sf_schema_vrsns and sf_schema_vrsns_meta_types (not mentioned). Discovered this via: http://docs.sitefinity.com/thunder-develop-a-custom-module-using-an-openaccess-data-provider

    2. How to flag the schema as requiring an update?
    The documentation doesn't include this detail either. By decompiling the source... I found that Telerik.Sitefinity.Data.OA.OpenAccessConnection.MetadataUpgradeFacade's CheckForUpgrade method is reading the CurrentSchemaVersionNumber property.  By default... this looks at the Assembly Builder number of the project and by default that number is static. So changing your type and mappings is not triggering a schema update. To fix this... either have visual studio auto-increment the build number of the project or override CurrentSchemaVersionNumber in the provider and change it on every edit. To auto-increment the build number... open AssemblyInfo.cs and update the AssemblyVersion line to [assembly: AssemblyVersion("1.0.*")]. Details on this syntax at: https://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute(v=vs.110).aspx

    Now the questions...

    3. How do you modify existing properties/columns? Basically... how do you write code migrations in this context? Examples might be property/column renames, extending a column's length, or changing requiredness.

    4. How do you delete an existing property/column?

    5. How do you add a new property/column?

    6. How do you migrate existing data during these changes?

    7. Can you setup a series of migration/deployment steps?

    Entity framework has migrations to accomplish this... but there's no mention in the Sitefinity documentation that I can find on a proper approach in the "Extend Data Model" context.

    Thanks for the help!

1 posts, 0 answered