Adding / Removing Database Fields In Custom Module
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?
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.*"
)]
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.
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
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.