SchemaTongs casts your database into versionable metadata-tables, views, procedures, and more-ready for deployment across environments.
SchemaTongs is the starting point of the SchemaSmith workflow. It connects to a SQL Server database and extracts metadata representing the current state of that database - tables, procedures, views, etc. This metadata becomes the raw material that feeds into the SchemaSmith toolchain for shaping and deploying your desired state across environments. We call this initial process of extracting schema definitions casting the database.
Simply point the application at each of your databases and everything within them will be extracted out to the folder of your choosing.
appSettings.json
| Setting | Value |
|---|---|
Source:Server | The server to connect and extract from. |
Source:User | The user to authenticate with. Leave blank to use Windows authentication. |
Source:Password | The password to authenticate with. Leave blank to use Windows authentication. |
Source:Database | The database to extract from. |
Product:Path | The base path for the product to write the metadata files to. |
Product:Name | The product name to write in product.json if one doesn't yet exist. Defaults to the final directory name in Path if omitted. |
Template:Name | The template name to write in template.json if one doesn't yet exist. Defaults to Source:Database if omitted. |
ShouldCast:Tables | Include Tables in the export. Defaults to true. |
ShouldCast:Schemas | Include Schemas in the export. Defaults to true. |
ShouldCast:UserDefinedTypes | Include User Defined Types in the export. Defaults to true. |
ShouldCast:UserDefinedFunctions | Include User Defined Functions in the export. Defaults to true. |
ShouldCast:Views | Include Views in the export. Defaults to true. |
ShouldCast:StoredProcedures | Include Stored Procedures in the export. Defaults to true. |
ShouldCast:TableTriggers | Include Table Triggers in the export. Defaults to true. |
ShouldCast:Catalogs | Include Full Text Catalogs in the export. Defaults to true. |
ShouldCast:StopLists | Include Full Text Stop Lists in the export. Defaults to true. |
ShouldCast:DDLTriggers | Include Database DDL Triggers in the export. Defaults to true. |
ShouldCast:XMLSchemaCollections | Include XML Schema Collections in the export. Defaults to true. |
ShouldCast:ScriptDynamicDependencyRemovalForFunctions | Indicates whether each scripted function should include code to dynamically remove any computed column, constraint, and indexes dependent on the function before updating it. The table update will restore them for any tables managed in the product. Depending on your environment and the impact of this, you might choose to handle such dependencies in another way. This option defaults to false. |
ShouldCast:ObjectList | A comma or semicolon delimited list of object names you wish to include in the current export. Leave blank for all. |
Execute SchemaTongs from the command line and the casting process will begin.
> SchemaTongs
Move on to editing your metadata with files using your favorite text editor.
See the SchemaTongs Walkthrough to help you get started with the tool.
The same concepts for how to override appSettings.json for SchemaQuench apply to SchemaTongs. You can also use Command Line Options to specify the log file location or an alternate config file.
| Objects | Directory |
|---|---|
product.json | Product:Path |
template.json | Product:Path\Templates\Template:Name |
| User Defined Types | Product:Path\Templates\Template:Name\DataTypes |
| DDL Triggers | Product:Path\Templates\Template:Name\DDLTriggers |
| Full Text Catalogs | Product:Path\Templates\Template:Name\FullTextCatalogs |
| Full Text Stop Lists | Product:Path\Templates\Template:Name\FullTextStopLists |
| Functions | Product:Path\Templates\Template:Name\Functions |
| Procedures | Product:Path\Templates\Template:Name\Procedures |
| Schemas | Product:Path\Templates\Template:Name\Schemas |
| Tables | Product:Path\Templates\Template:Name\Tables |
| Triggers | Product:Path\Templates\Template:Name\Triggers |
| Views | Product:Path\Templates\Template:Name\Views |
| XML Schema Collections | Product:Path\Templates\Template:Name\XMLSchemaCollections |
Export Notes:
TemplateOrder. You should tweak any properties such as the ValidationScript to suit your actual needs.DatabaseIdentificationScript and VersionStampScript to suit your actual needs.Pair SchemaTongs with automated checks running SchemaQuench in CI so every cast is tested and versioned before it reaches production.