I think I might have this completely wrong, but I was under the impression that the module installer in Dnn would only run the Sql Provider scripts from the current version on. E.g. Assume that my module has reached version 3.0.0 but I'm currently running version 02.00.01 in production:
In 01.00.00.SqlDataProvider I ensure that tables don't already exist and drop them if they do before creating them again In 01.00.23.SqlDataProvider I decided to make a couple of adjustments to the core data in these tables - no problem here as it mostly has to do with lookup list tables. In 02.00.01.SqlDataProvider I add more functionality and hence more tables to the system In 02.00.22.SqlDataProvider some more work, etc. etc. A couple of versions on and I reach version 3.0.0
The problem I'm seeing is that when I do the installation of version 3.0.0 it's running the scripts all the way from version 1 through 3 which means the tables are being cleaned out, recreated. Yes, my initial script is doing that, but my assumption was that Dnn would only run the script files starting at 02.00.22 since I'm currently at 02.00.01 in production. So my assumption was incorrect all this time?
Michael TobischDNN★MVP
hi Michael,
I didn't no. This is a WebAPI module with a completely seperate Angular based application. I just did a little bit of reading on IUpgradeable and although I can see that it "should" call the UpgradeModule method multiple times and "It is called only for script versions that are later than the version of the currently installed module." I didn't see any examples that explicitly call the SqlDataProvider scripts.
What did you have in mind?
Hi Michael,
The versions are as follows: Dnn manifest: 02.01.13 Assembly version: 2.1.13.0 Last SqlDataProvider file version: 02.01.13.SqlDataProvider
I'm not too clear on how Dnn handles major, minor, build, etc. but the above is how I've done it at the moment.
Regards, Jacques
Jacques,
it seems to me that the upgrade procedure is calling all SQL scripts from start, but I am not sure (and as I said, I never experienced this). So maybe you should implement a basic IUpgradeable interface, which is as simple as this:
public class myBusinessController : IUpgradeable { //... public string UpgradeModule(string version) { return string.Format("Upgrading to version {0}", version); } //... }
Happy DNNing! Michael
To understand IUpgradeable, there is a quite old but still valid article by Vicenç Masanas here: Installing and upgrading modules in DNN, a developer's view > DNN Corp (dnnsoftware.com). The only thing that changed afaik is the possibility to call the SQL Provider script's names to a different convention, but this way still works, and if you do it with other names you have to take these names into account in the manifest. Also the cleanup can be handled in the manifest, and the cleanup files (xx.xx.xx.txt) are not necessary when you do it this way.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.