Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Script Component

Return to previous page

  • 4/7/2015
  • 10326 Views

Comments

10326 Views

Script Component

Last updated 6 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 

The script component is used execute SQL scripts on the database. It is usually used by modules to install and/or upgrade the tables and stored procedures required for their data storage needs.



The Script Component inherits from the File Component and uses a similar sintax.



All SQL scripts must be named by using a format like "[version].[dataprovidertype]", where:

  • version is the sequential version number of the script (this will be used to execute the scripts in the correct order), for example "00.00.01"
  • dataprovidertype identifies the dataprovider being used. By default DNN uses the SQL Server DataProvider identified by "SqlDataProvider" (for example: "00.00.01.SqlDataProvicer"). Other data providers might use other prefixes. The data provider definition can be found on the web.config file on the "data" section group.

When upgrading a package only scripts with a version greater than the currently installed version will be executed.



Elements and attributes



  • type: identifies if the script will be used when installing or uninstalling the package. An uninstall script must be named explicitely "uninstall.*" otherwise will not be executed when uninstalling the package.
  • basePath: where the scripts will be saved after installation
  • path: the folder where the script will be copied (relative to basePath)
  • name: the name of the script file
  • version: sequential version of the script file, used to correctly execute the scripts in the right order

The Script component supports two special names for scripts that will be considered in a different way than usual scripts:


  • install.SqlDataProvider: if the package is being installed for the first time, this script will be executed before all other scripts
  • upgrade.SqlDataProvider: after all regular scripts have been executed, DNN will process this script if present. If there is an "upgrade" script on the package it will be executed ALWAYS as the final script



Sample

DesktopModules\MyModule



References

Contents
No sections defined
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out