SchemaTongs Walkthrough — SQL Server
Point SchemaTongs at a SQL Server database, extract the live schema into structured JSON and SQL files, and explore the package ready for version control — the cast leg of the SchemaSmith cycle in 10 minutes.
SchemaTongs grips your live schema and casts it into structured files.
Prerequisites
You need three things before starting the walkthrough — the SchemaSmith binaries, a SQL Server you can read from, and the demo schema package this walkthrough drives.
SchemaSmith tools
Download self-contained ZIP packages from the latest GitHub release and extract them anywhere on your PATH. No .NET runtime required.
A database server
Either an existing SQL Server instance or Docker (recommended). The SchemaSmith repository includes a Docker Compose file that starts the demo server for you.
The demo files
Clone the repository or download just the Demos/ folder:
git clone https://github.com/Schema-Smith/SchemaSmithyFree.git
cd SchemaSmithyFree
Step 1: Start the Demo Environment
Each platform has its own demo folder under Demos/ with a run-demo launcher, a docker-compose.yml, and a .env credentials file. From the repository root, launch the SQL Server demo:
cd Demos\SqlServer
run-demo.cmd
cd Demos/SqlServer
./run-demo.sh
The launcher runs build-schemaquench.sh to compile the SchemaQuench binary (requires the .NET SDK on the host), then docker compose up --build packages that binary into a local Docker image, starts a SQL Server instance on port 1440, and deploys the demo databases using SchemaQuench. The launcher blocks until the completed service exits, which signals the databases are ready. Credentials live in Demos/SqlServer/.env:
| Setting | Value |
|---|---|
| SQL Server | localhost,1440 |
| User | TestUser |
| Password | (see Demos/SqlServer/.env) |
Step 2: Cast with SchemaTongs
Now let's go the other direction. Pretend you already have a database and want to bring it under SchemaSmith management. SchemaTongs grips your live schema and casts it into structured files.
Create a SchemaTongs configuration file called tongs-extract.json:
{
"Source": {
"Platform": "SqlServer",
"Server": "localhost,1440",
"User": "TestUser",
"Password": "your-password-here",
"Database": "Northwind"
},
"Product": {
"Path": "./my-northwind",
"Name": "Northwind"
},
"Template": {
"Name": "Northwind"
},
"ShouldCast": {
"Tables": true,
"Schemas": true,
"UserDefinedTypes": true,
"Functions": true,
"Views": true,
"Procedures": true,
"TableTriggers": true,
"Catalogs": true,
"StopLists": true,
"DDLTriggers": true,
"XMLSchemaCollections": true,
"IndexedViews": true
}
}
Run the extraction:
SchemaTongs --ConfigFile:tongs-extract.json
Look at what appeared in the my-northwind/ folder. You now have a complete schema package:
my-northwind/
Product.json ← Platform, templates, tokens
.json-schemas/ ← JSON Schema validation, generated on the fly
Templates/
Northwind/
Template.json
Tables/
dbo.Categories.json
dbo.Customers.json
dbo.Orders.json
... (13 tables)
Views/
dbo.Alphabetical list of products.sql
...
Procedures/
dbo.CustOrderHist.sql
...
Schemas/
Functions/
Triggers/
Table Data/
Every table is a JSON file describing its columns, indexes, and constraints. Every stored procedure and view is a plain SQL file. This is your entire database — materialized as readable, diffable, reviewable source files. Commit this to source control and you have a complete history of every schema change from this point forward. For the full set of extraction options, see the SchemaTongs reference.
That's the cast. A live database, captured in files you can read, review, and version.
Step 3: Explore the Package
No GUI editor needed — the schema package is designed to read clearly in any editor or IDE. Open my-northwind/ in VS Code, JetBrains Rider, Visual Studio, or whatever your team uses. The .json-schemas/ folder gives you validation and autocomplete for every JSON file in the package automatically.
Click through Tables/dbo.Categories.json. You'll see the column definitions, the primary key, and any indexes. Open a stored procedure in Procedures/ and you see the full SQL definition ready to diff in a pull request. This is what schema review looks like when the files are designed for it: structured enough for tools, readable enough for humans, diff-friendly enough for code review.
Take a minute to click around. Every table, every view, every procedure in the Northwind database is here, structured and browsable. No server connection needed to explore.