Adding / Removing Database Fields In Custom Module

Posted by Community Admin on 05-Aug-2018 01:48

Adding / Removing Database Fields In Custom Module

All Replies

Posted by Community Admin on 11-May-2011 00:00

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?

Posted by Community Admin on 16-May-2011 00:00

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 >>

Posted by Community Admin on 30-Jun-2011 00:00

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.

Posted by Community Admin on 06-Jul-2011 00:00

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.

Regards,
Vlad
the Telerik team

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

Posted by Community Admin on 12-Jul-2012 00:00

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.  

This thread is closed