SchemaInstallScripts vs SchemaUpgradeScripts

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/12/2010 10:21:16 AM
Gravatar
Total Posts 156

SchemaInstallScripts vs SchemaUpgradeScripts

So I was watching a tutorial on how to go about creating stored procedures, etc and I noticed that the config (sql file) that created the tables was of version 0.0.0.1.config and resided in SchemaInstallScripts whereas the config file for adding stored procedures was named 0.0.0.2.config and resided in SchemaUpgradeScripts.  Couldn't you have named the file for adding stored procedures 0.0.0.1.config as well as it's in the SchemaUpgradeScripts?  Doesn't the Setup/Default.aspx  first read all the files in the version acsending order within SchemaInstallScripts and then does the same for SchemaUpgradeScripts? 

 

I'm just trying to make sure I understand completely how the installation/upgrade system works.  Thanks in advance.

6/12/2010 1:12:40 PM
Gravatar
Total Posts 18439

Re: SchemaInstallScripts vs SchemaUpgradeScripts

Hi,

They do have different purposes. There should always only be one script in the Install folder, and all subsequent scripts should go in the upgrade folder. The version of the script is recorded in the database so we never run scripts that have already completed, so we can re-use version numbers in the upgrade scripts folder.

Now the purpose of the install folder being separate instead of just putting all the scripts in one place, is because over time the number of scripts keeps growing and we get to a point where we don't want to run every script that ever existed for new installations. Even now, the number of scripts run for mojoportal-core on a new install is pretty long and soon I may create a new install script that consolidates the current schema into one higher version script so that new installs don't need to run so many. So with a newer version install script it would just skip over most of the upgrade scripts since they would be lower versions, but those upgrading from older versions won't have any missing scripts in the upgrade folder even if they haven't upgraded in a long time.

Hope that explains it.

Best,

Joe

6/12/2010 1:21:51 PM
Gravatar
Total Posts 156

Re: SchemaInstallScripts vs SchemaUpgradeScripts

Thank you for that explanation.  It makes sense.  Also, that was your 8888th post :P

10/26/2010 10:53:40 AM
Gravatar
Total Posts 156

Re: SchemaInstallScripts vs SchemaUpgradeScripts

So if SchemaInstallScripts is supposed to contain only one file, then why does 2.3.5.4 MSSQL deployment package contains two files in /Setup/applications/blog/SchemaInstallScripts/mssql -  0.0.0.1.config and 0.0.1.8.config?

10/26/2010 11:48:50 AM
Gravatar
Total Posts 18439

Re: SchemaInstallScripts vs SchemaUpgradeScripts

Actually I over-stated it when I said there should never be more than one script in that folder. In truth, it does not really cause any problem because it will only run the highest version script from that folder and then it will move on to the upgrade scripts. I think at one time it was a problem but I later added logic to make sure it always uses only the highest version script from there, otherwise it would pose a problem if they upgraded over time and there was more than one script there and then they later changed the connection string to a new empty db. So at one time I was very cautious about not putting more than one script there but now it doe snot cause any problems.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.