SketchBot.io

Abstract

This Microsoft Visio application add-in is used to create visually appealing database entity-relationship diagrams. The add-in can be assigned to read table information from an MS-SQL database and populate a Visio diagram with the table information.

SketchBot will enable you to create entity relation diagrams from existing databases. SketchBot will populate all the shape data fields to match the database. For example, it will find triggers, apply data types, index and uniqueness notation.

Technologies: SQL Server, C#, WPF, MVVM, Microsoft Visio Automation

YouTube Demonstration

You can find videos related to SketchBot and other topics on my YouTube channel. Just search for Delaney's space.

Select the SQL Server and database from the lists. Click Import. The database tables will be listed.
Select a table and click Render. Microsoft Visio will open and the table will be rendered.
Move the table to a new location in the diagram. Select another table to render it.
Click and drag one of the relationship line shapes, used for joining the tables.
Join the tables manually. SketchBot cannot do this job as well as a human, when the diagram become complex.
Repeat until you have your diagram.

Embellish Your Fields

Add meta data to fields

Ungroup a table, by right mouse clicking on it and selecting Ungroup.
Re-order fields by dragging and dropping.
Show shape meta data, by right mouse clicking a field and selecting Data | Shape Data...
Below is the shape data for the Email field. Some of the entries will be explained in the next few storyboards.
Field properties explained.
Property Description
Name Holds the name of your database table field.
Property Name (optional) Holds the name of the field as it appears in an application.
Is Primary Key Set this to true and watch your field turn grey to highlight its primary key status.
Is Nullable Set this to true to display NULL in your field. Now you can instantly see if your field is nullable.
Type Choose an SQL Server data type from the list. The field will be updated with your new selection.
Size Enter the field size here.
Size Decimal Scale Field size used with decimal data type.
Sort Order Select an up or down arrow to illustrate your tables preferred sort order.
Sort Priority Add a number here to denote the sort priority when you are sorting for many fields.
Is Not Used Set this to true if your field is not used, but you presently decline from removing it.
Default Your field may contain a default value. Store it here.
Is Unique Set this to true to highlight in the diagram that your values should be unique. The field will be annotated with a UQ.
Unique Group Id Group your unique fields by adding an ID here.
Is Indexed Set this to true to highlight in the diagram that your field has an index. The field will be annotated with a IX.
Index Group Id Group your indexed fields by adding an ID here.
Index Priority Prioritise the indexes in a group.
Index Order Illustrate whether index ascending or descending.
The Email field has been updated to show that contents should be unique and has an ascending index.

Embellish Your Tables Title

Add meta data to table titles

Edit the table title metadata in the same way field metadata is edited. Select the table title to show the shape data. See the previous storyboard for details.
Table Title properties explained.
Property Description
Schema Type a schema name here. You will see your change in the title text.
Name Type a table name here. You will see your change in the title text.
Namespace (optional) Holds the namespace the table belongs to with in the application.
Class Name (optional) Holds the name of table as it appears in an application class.
Is Not Used Set this to true if your table is not used, but you presently decline from removing it.
Trigger (After) Set true to highlight that your table contains at least one 'after-trigger'. The table title will be annotated with tr_aft.
Trigger (Instead of) Set true to highlight that your table contains at least one 'instead-of-trigger'. The table title will be annotated with tr_insd.
Is Key Value Pair Set true to highlight that your table is a key-value pair list. The table title will be annotated with KV.

Conclusion

SketchBot does more than creating entity relationship diagrams. These diagrams also can be used with ScriptBot. Head over to ScriptBot.io for find out more.

Copyright © Delaneys.Space 2022 - Generated by ScriptBot and crafted by Delaney.