Instructions for Customizing Visio (last updated 9.16.2013) Use the following nine screen shots to customize Visio for use in MIS 3350/4340/5340/5346. Read instructions carefully; some steps only apply to MIS4340/5340. 1. Select Software and Database; Database Model Diagram; click Create 1 2. For MIS4340/5340 ONLY: Choose Database | Options | Drivers… 2 3. FOR MIS4340/5340 ONLY: Some versions will show a “Set as Default” button in addition to the information below; if so, then after highlighting “Microsoft SQL Server”, click the “Set as Default” button, then click OK. 3 4. Next choose Database | Options | Document… 4 5. On the General tab, choose the Relational symbol set, and Conceptual names visible on the diagram. 5 6. On the Table tab, ensure only Primary keys and Non keys are displayed; under Order, ensure Primary keys at top is selected; and ensure Data types are not shown. 6 7. On the Relationship tab, Show Relationships and Crow’s feet; for Name display, Show verb phrase, Forward text only. 7 Using Visio to Create Conceptual ERDs 1. Add entities to your diagram by dragging and dropping the “Entity” shape onto the drawing area. NOTE: there are no special symbols in Visio for associative entities—they will look just like any other entity. For each entity: a. Right-click entity and select Database Properties b. Highlight Definitions; specify conceptual name for entity (ensure "sync names" option is selected) c. Highlight Columns; specify columns/attributes for entity (be sure to indicate PK columns by checking box) 2. FOR MIS434/5340 ONLY: Add relationships manually to diagram by dragging and dropping the “Dynamic Connector” shape onto the drawing area between the related entities. For each relationship: a. Drag each end of the relationship to the center of the entities that are related (ensure each entity turns red) b. To add cardinalities to the relationship, i. Right-click the relationship and select Format, then select Line… ii. In the Line Ends section, for both the Begin and End portions of the line, choose from styles 25, 28, 29, or 30 to depict min and max cardinality for relationship (you may optionally change begin and end sizes to Large to make symbols easier to see) iii. Click OK c. To label the relationship, i. Double-click the relationship, then type the label in the text box ii. Click outside the text box when done 3. Add relationships with the Relationship shape by dragging and dropping the “Relationship” shape onto the drawing area between the related entities. A 1:M optional relationship will default. NOTE: You cannot change the max cardinality on the 1 side of the relationship, so pay attention to the direction of your 1:M relationship. a. To change the cardinality: i. Ensure the relationship is highlighted so that the Database Properties window displays ii. Click on the Miscellaneous category To get a 1:1 relationship that is optional on the 1 side: iii. In the Cardinality column, choose “Zero or one” To get a 1:1 relationship that is mandatory on the 1 side: iv. In the Cardinality column, choose “Exactly one”. To get a 1:M relationship that is mandatory on the M side: v. In the Cardinality column, choose “One or more” To get a 1:M relationship that is mandatory on both sides: vi. In the Cardinality column, choose “One or more” vii. In the “Relationship type” column, choose “Identifying”. If the primary key of the 1-side entity becomes part of the primary key of the M-side entity, highlight the M-side entity, choose the Columns category, then uncheck the PK box of the fields that were added to the PK of the entity. b. To label the relationship, i. Click on the Name category ii. Type the label in the Verb phrase box 4. To add text to the ERD (for labels and/or for volumes) a. click on the text tool b. type in the desired text c. position/size the text as desired 5. To add a generalization hierarchy to ERD, follow the instructions on the next page. 8 Shapes to Use for Creating Generalization Hierarchies Entity Parent to Category Category Category to Child (2 of them) 9 FOR MIS4340/5340 ONLY Using Visio to add Logical Design Specs to ERDs 1. Add foreign keys automatically to your entities by: a. Right-click entity and selecting Database Properties b. Highlight “Columns” category c. Specify the foreign key columns/attributes for entity IF the attribute(s) have not already been added by Visio. Be sure to include the (FK) designation after the column/attribute name. d. If your FKs do not appear on the ERD, ensure the FK display is set by doing the following: i. Choose Database, Options, Document… from the top menu ii. Click on the Table tab iii. In the Display column, check Foreign Keys; click OK 2. Add referential integrity constraints to your relationships by: a. Highlight the relationship to display Database Properties b. Choose the Referential Action category c. Select both “On parent update” and “On parent delete” options as follows: i. To restrict, select “No action” ii. To cascade, select “Cascade” iii. To set null, select “Set NULL” (if this option is not selectable, then just pick one of the two options above) d. If the Referential integrity constraints do not appear on the ERD, ensure the referential actions display is set by doing the following: i. Choose Database, Options, Document… from the top menu ii. Click on the Relationship tab iii. In the Show column, check Referential actions; click OK 10