Git Product home page Git Product logo

schemazenplus's Introduction

Schema Zen Plus - Script and create SQL Server objects quickly & additional SSDT support

Schema Zen Plus has five main commands:

script

SchemaZen.exe script -c "server=localhost;database=db;trusted_connection=yes;" --scriptPath c:\somedir\script.sql

This will generate an sql script that creates objects in the database in the specified path:

c:\somedir\
	script.sql

The script's routines (procedures, functions etc) are generated by their dependency order, so you should be able to just run the script on an empty database and it will take care of everything. You can cancel this options by the --no-depends flag to make it load faster

Another added option, is to specify which object types to script from the below list:

[user_defined_types, tables, foreign_keys, assemblies, functions, procedures, triggers, views, xmlschemacollections, data, roles, users, synonyms, table_types, schemas, props, permissions, check_constraints, defaults, routines]

Use it like: --onlyTypes users,tables
If empty, includes all

create

SchemaZen.exe create -c "server=localhost;database=db;trusted_connection=yes;" --scriptPath c:\somedir\script.sql

This will create a database named db from the sql scripts in c:\somedir\script.sql

compare

SchemaZen.exe 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.

Another added option, is to specify which object types to script from the below list:

[user_defined_types, tables, foreign_keys, assemblies, functions, procedures, triggers, views, xmlschemacollections, data, roles, users, synonyms, table_types, schemas, props, permissions, check_constraints, defaults, routines]

Use it like: --onlyTypes users,tables
If empty, includes all

export

SchemaZen.exe export -c "server=localhost;database=db;trusted_connection=yes;" --exportDir c:\somedir

This will export the data from the database to c:\somedir\data

import

SchemaZen.exe import -c "server=localhost;database=db;trusted_connection=yes;" --importDir c:\somedir

This will import the data from the folder c:\somedir\data to the database

See SchemaZen.exe help [command] for more information and options on each command.

SSDT

This project was meant to work with SSDT but without using their deployment system to enable more flexibility over the migrations.
You would need an additional library like DbUp or so. PS scripts will be added in the future to support this functionality.
The idea is, to do changes via SSDT (for example alter a stored procedure) and then run a command in the PM Console to generate a script from the changes. I Like to remove all the routines (stored procedures, views, functions etc) pre-migration and append them post-migration so they will only appear once in the migration process and to solve dependency issues (for example a procedure that references a table type).
An example usage project will be added in the future.

Contributing

Pull requests are welcome and appreciated. See contributing.md for guidelines.

Additional Notes

I forked this repo from sethreno/schemazen.
This was an amazing project, but it is a bit unmaintaned in the last couple of years.
I added and changed some functionality as I needed, and shared it here in case someone would also be interested in that.
I don't like the coding style so much, so I might change it in the future to a more appropriate one, although currently I have no time for that.
You are welcome to try it, tell me if it needs additional features or has bugs, and send pull requests.

schemazenplus's People

Contributors

sethreno avatar keith-hall avatar idan-h avatar danbrad avatar mobilebilly avatar colin-hanson-zocdoc avatar marcio-santos-zocdoc avatar tony-zheng-zocdoc avatar scott-roepnack-zocdoc avatar uzitech avatar rhumborl avatar asclearuc avatar eliah-hecht-zocdoc avatar constantinek avatar yzzyx avatar franksiler avatar gitter-badger avatar

Stargazers

long avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.