More in this section
Forums / Sitefinity SDK / Adding / Removing Database Fields In Custom Module

Adding / Removing Database Fields In Custom Module

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
5 posts, 0 answered
  1. Victor
    Victor avatar
    15 posts
    24 Mar 2011
    11 May 2011
    Link to this post
    Running 4.0,  I needed to add a few fields and drop other persisted fields in a custom module.  What is the "best practice" for having OA regenerate the tables, AFTER the module has already been registered?
  2. R. Atanasov
    R. Atanasov avatar
    19 posts
    03 Nov 2014
    16 May 2011
    Link to this post
    Hello Victor,

    Unfortunately I cannot fully understand your question. Do you mean how to provide upgrade from previous versions of your module after changing the OpenAccess mapping or how to force applying your changes during development? And do you use 4.0 or 4.1? Is your module updated to use the fluent mapping API?

    Actually there are a number of ways to force upgrading your database schema to reflect your OpenAccess mapping. The most straightforward way is to use different assembly versions. During development you can use the AssemblyVersion attribute in the following way:

    [assembly: AssemblyVersion("1.0.*")]

    which will make your assembly version build number to increase daily and revision number - with each build. This will make Sitefinity's OpenAccess layer to create an upgrade script and apply it to your database.

    Does this help?

    Kind regards,
    Radoslav Atanasov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. Suzanne
    Suzanne avatar
    43 posts
    12 Jul 2012
    30 Jun 2011
    Link to this post
    I updated the AssemblyVersion in my custom module as suggested below, but the changes I made to the fluent mapping - setting field length to MAX using -> .IsLongText(this.Context).IsNullable() -> did not update the database table.
  4. Vlad
    Vlad avatar
    498 posts
    19 Jun 2017
    06 Jul 2011
    Link to this post
    Hi Suzanne,

    It's very strange.
    Could you please check if the module is really upgraded? Open the table 'sf_schema_vrsns' in the database, find the record for your module. In the column 'assembly' the version number should be the same as the version of the module assembly in the bin folder. Additionally, you can try to force upgrade by setting the value in meta_data_changed column to 1. After the upgrade, Sitefinity should set it to 0.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  5. Simon
    Simon avatar
    10 posts
    08 Jun 2012
    12 Jul 2012
    Link to this post
    I am in the same situation. I updated my assembly file and even deleted the version off the systemconfig file.  i even placed a TRUE under meta_data_change and restarted by updating webconfig, stoped the site, rebuild the site, etc.  it kept the value as 1.  
5 posts, 0 answered