SchemaTongs - Schema-Smith/SchemaSmithEnterpriseDemos GitHub Wiki
Overview
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.
Where SchemaTongs Fits
graph LR
A[SchemaTongs: Extract Metadata] --> B[SchemaHammer: Edit & Revise Metadata]
B --> C[SchemaQuench: Apply Metadata to Target Server]
classDef tool fill:#1e2a38,stroke:#4fc3f7,stroke-width:2px,color:#ffffff;
class A tool;
Quick Start Guide
Follow these steps to get started with SchemaQuench:
- Configure your
appSettings.json
file:
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 the product.json if one doesn't yet exist. The product name will default to the final directory in the Path if not provided. |
Template:Name | The template name to write in the template.json if one doesn't yet exist. The template name will default to Source:Database if not provided. |
ShouldCast:Tables | Indicates whether Tables should be included in the current export. Defaults to true. |
ShouldCast:Schemas | Indicates whether Schemas should be included in the current export. Defaults to true. |
ShouldCast:UserDefinedTypes | Indicates whether User Defined Types should be included in the current export. Defaults to true. |
ShouldCast:UserDefinedFunctions | Indicates whether User Defined Functions should be included in the current export. Defaults to true. |
ShouldCast:Views | Indicates whether Views should be included in the current export. Defaults to true. |
ShouldCast:StoredProcedures | Indicates whether Stored Procedures should be included in the current export. Defaults to true. |
ShouldCast:TableTriggers | Indicates whether Table Triggers should be included in the current export. Defaults to true. |
ShouldCast:Catalogs | Indicates whether Full Text Catalogs should be included in the current export. Defaults to true. |
ShouldCast:StopLists | Indicates whether Full Text Stop Lists should be included in the current export. Defaults to true. |
ShouldCast:DDLTriggers | Indicates whether Database DDL Triggers should be included in the current export. Defaults to true. |
ShouldCast:XMLSchemaCollections | Indicates whether XML Schema Collections should be included in the current export. Defaults to true. |
- Run SchemaTongs: Execute SchemaTongs from the command line and tongs will begin the casting process.
- Shape your metadata: Move on to editing your metadata with SchemaHammer or your favorite text editor.
The same concepts for how to override appSettings.json for SchemaQuench apply to SchemaTongs
.
What is exported
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
- product.json: Will be created for the first cast to a given product path. New templates will be added to the TemplateOrder. You should tweak any properties such as the ValidationScript to suit your actual needs.
- template.json: Will be created for the first cast to a given template path. You should tweak any properties such as the DatabaseIdentificationScript and VersionStampScript to suit your actual needs.
Best Practices
- Incremental Adoption: Begin with non-critical objects to familiarize yourself with the tool's workflow.
- Version Control Integration: Keep your metadata files under source control to track changes and collaborate effectively.
- Environment Segregation: Use different configurations for development, staging, and production to prevent accidental deployments.
- Regular Validation: Periodically validate that the target databases match the desired state defined in your metadata.
Additional Resources
- SchemaTongs Walkthrough: A step-by-step guide for extracting the sample product.
- SchemaHammer: An IDE for your metadata.
- SchemaQuench: Learn how to quench your databases.
- Product Definition Guide: Understand how to structure your metadata into products.
- Template Creation Tutorial: Discover how to create templates for different environments.
- Product Demos: Known sample databases converted to our metadata format.