Configurable Product and Template script folders - Schema-Smith/SchemaSmithEnterpriseDemos GitHub Wiki
Because products and templates have different scopes in the quench process (product is global in scope and template is database by database), they each have their own folder customizations that can be done.
Folder type | Property | Description |
---|---|---|
Product | ||
FolderPath | The relative path from the product json file where this particular folder can be found. | |
ServerToQuench | One of Primary Secondary or Both . Default is Primary . This property allows support for clustered installations. Some actions, like creating logins, need to occur on both the primary and secondary servers. Other actions, like function creation, only need to occur on the primary since it will be synchronized. The configuration for the primary and secondary servers is setup in the appSettings.json file. |
|
QuenchSlot | One of Before or After . This allows for before and after product scripting. |
|
Template | ||
FolderPath | The relative path from the template json file where this particular folder can be found. | |
QuenchSlot | One of Before , Objects , AfterTables , AfterTablesObjects or After . Before , AfterTables , and After are similar to the product level letting you configure things at the start and end of the database quench as well as after the structure update but prior to constraints being applied. Objects are the slot for common sql objects like functions , views or stored procedures . AfterTablesObjects are done just after quenching tables and just before the After slot. A common use case for this slot would be for applying Triggers . Both of the object slots retry applying objects until all dependency order issues are resolved or the same error(s) remain and no more progress can be made. |
A sample product script folder setting may be something like this added to your product.json
:
{
"ScriptFolders": [
{ "FolderPath" : "Before Product", "QuenchSlot" : "Before" },
{ "FolderPath" : "Jobs", "QuenchSlot" : "After", "ServerToQuench" : "Both" },
{ "FolderPath" : "After Product", "QuenchSlot" : "After" }
],
}
[!TIP] The
Before Product
andAfter Product
are defaulting theServerToQuench
toPrimary
taking unnecessary clutter out of the json and calling outJobs
as having something more atypical in its setup.
A sample template script folder setup may be something like this added to your template.json
:
"ScriptFolders": [
{ "FolderPath" : "MigrationScripts/Before", "QuenchSlot" : "Before" },
{ "FolderPath" : "Schemas", "QuenchSlot" : "Objects" },
{ "FolderPath" : "DataTypes", "QuenchSlot" : "Objects" },
{ "FolderPath" : "FullTextCatalogs", "QuenchSlot" : "Objects" },
{ "FolderPath" : "FullTextStopLists", "QuenchSlot" : "Objects" },
{ "FolderPath" : "Functions", "QuenchSlot" : "Objects" },
{ "FolderPath" : "Views", "QuenchSlot" : "Objects" },
{ "FolderPath" : "Procedures", "QuenchSlot" : "Objects" },
{ "FolderPath" : "Triggers", "QuenchSlot" : "AfterTablesObjects" },
{ "FolderPath" : "MigrationScripts/After", "QuenchSlot" : "After" }
]
[!IMPORTANT] The order the folders are declared is the order they will be processed within their respective slots. In other words, if in the example above you moved
Schemas
aboveMigrationScripts/Before
, the order processed would still beMigrationScripts/Before
,Schemas
,DataTypes
and so on.