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 PostgreSQL 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 | 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:DomainTypes | Indicates whether Domain Types should be included in the current export. Defaults to true. |
ShouldCast:EnumTypes | Indicates whether Enum Types should be included in the current export. Defaults to true. |
ShouldCast:CompositeTypes | Indicates whether Composite Types should be included in the current export. Defaults to true. |
ShouldCast:Functions | Indicates whether Functions, Trigger Functions and Window Functions should be included in the current export. Defaults to true. |
ShouldCast:Aggregates | Indicates whether Aggregates should be included in the current export. Defaults to true. |
ShouldCast:Procedures | Indicates whether Procedures should be included in the current export. Defaults to true. |
ShouldCast:Sequences | Indicates whether Sequences should be included in the current export. Defaults to true. |
ShouldCast:Rules | Indicates whether Rules should be included in the current export. Defaults to true. |
ShouldCast:Triggers | Indicates whether Triggers 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: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 SchemaHammer.
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 |
| Schemas | Product:Path\Templates\Template:Name\Schemas |
| Domain Types | Product:Path\Templates\Template:Name\Domain Types |
| Enum Types | Product:Path\Templates\Template:Name\Enum Types |
| Composite Types | Product:Path\Templates\Template:Name\Composite Types |
| Functions | Product:Path\Templates\Template:Name\Functions |
| Trigger Functions | Product:Path\Templates\Template:Name\Trigger Functions |
| Window Functions | Product:Path\Templates\Template:Name\Window Functions |
| Aggregates | Product:Path\Templates\Template:Name\Aggregates |
| Procedures | Product:Path\Templates\Template:Name\Procedures |
| Sequences | Product:Path\Templates\Template:Name\Sequences |
| Tables | Product:Path\Templates\Template:Name\Tables |
| Rules | Product:Path\Templates\Template:Name\Rules |
| Triggers | Product:Path\Templates\Template:Name\Triggers |
| Views | Product:Path\Templates\Template:Name\Views |
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.