VistaDB 6
VistaDB / Tools User's Guide / Data Builder / Menu Commands / SQL Script / Data Builder - Export Schema as Scripts
In This Topic
    Data Builder - Export Schema as Scripts
    In This Topic

    As part of your configuration management strategy for your database it's a best practice to have a copy of the entire database schema checked into your Source Code Management System (SCMS), done as text files so you can see the differences between each version of your software by seeing the differences between text files.  VistaDB does this by creating a TSQL Script for each object in the system, organized by object type (table, views, functions, and stored procedures).  An individual Table script includes all of the foreign key relationships from that table to another table and the indexes. 

    Generating and Re-Generating the Reference Scripts

    Select the Export Schema as Scripts option from the SQL Scripts menu with the database you want to export open.  Select the root folder you want to put all of the script data in.  This folder should be empty (if this is your first time exporting) or only include the output from a previous run of the command.  Any extra files in the subfolders used for each object type will be deleted when the command completes.  Individual files are only updated if their schema has changed, optimizing interactions with your SCMS.

    Running Individual Scripts

    You can use each individual script to add its object to a database, but the scripts assume the object doesn't already exist.  If you want to make a copy of an entire database use the Data Builder - Generate Schema Deployment Script command instead.  When preparing an upgrade script to go between two versions of your schema you can look at the difference between the script files created by this method and copy the relevant changed snippets into a single script to run (separated by GO statements).  For changed relationships and indexes you'll have to drop any existing item first.

    See Also