DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Custom Module Installation cleans out table data

 13 Replies
 2 Subscribed to this topic
 26 Subscribed to this forum
Sort:
Page 1 of 212 > >>
Author
Messages
New Around Here
Posts: 6
New Around Here

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?

Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!
Never had this experience. Have you implemented the IUpgradeable interface correcty?

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
New Around Here
Posts: 6
New Around Here

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? 

Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!
Jacques,

Well, there are some points to take care. I think it could have to do something with the version number of your assembly. Have you set this to the correct version? Also check the version number(s) in your manifest.

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
New Around Here
Posts: 6
New Around Here

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

Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!

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:

<code>public class myBusinessController : IUpgradeable {<br />    //...<br />    public string UpgradeModule(string version)<br />    {<br />       return string.Format("Upgrading to version {0}", version);<br />    }<br />    //...<br /> }</code>

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!

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.

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
New Around Here
Posts: 6
New Around Here
This makes sense and the behavior that I would expect:
"Execution of sql scripts is more or less the same: each file with a version number greater than the current version number stored on the DesktopModules table, and less or equal than the number included in the node of the .dnn installer manifest will be run in order."
However this is not what I'm experiencing. I'm going to give it a proper read through again and then see if I'm missing something, but so far I can't see it.
Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!
Jacques,

did you check the version number in the DesktopModules table?

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
New Around Here
Posts: 6
New Around Here
I did yes, so along with the versioning I added in an earlier post:
Dnn manifest: 02.01.13
Assembly version: 2.1.13.0
Last SqlDataProvider file version: 02.01.13.SqlDataProvider
DesktopModules Table: 02.00.29.00

The version found in DesktopModules is what I would expect prior to the upgrade.
Page 1 of 212 > >>

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved