dotnet schemazen script --server localhost --database db --scriptDir c:\somedir
This will generate sql scripts for all objects in the database in a directory structure that looks something like:
c:\somedir\
data
foreign_keys
procedures
tables
views
props.sql
schemas.sql
dotnet schemazen create --server localhost --database db --scriptDir c:\somedir
This will create a database named db from the sql scripts in c:\somedir.
dotnet schemazen compare --source "server=dev;database=db" --target "server=qa;database=db" --outFile diff.sql
This will compare the databases named db
between dev
and qa
and
create a sql script called diff.sql
that can be run on qa
to make it's
schema identical to dev
.
See dotnet schemazen help [command]
for more information and options on each command.
If you don't already have a tool manifest in your project
dotnet new tool-manifest
Install SchemaZen
dotnet tool install SchemaZen
Script your database to disk
dotnet schemazen script --server localhost --database db --scriptDir c:\somedir
SchemaZen was changed to a cross platform dotnet tool in version 2.0. Older 1.x releases can be downloaded here
Pull requests are welcome and appreciated. See contributing.md for guidelines.
If you've found Schema Zen helpful you can buy me a coffee to say thanks. Cheers!