Skip to content

Commit 5df0250

Browse files
authored
Merge pull request #11 from LIDSOL/feat-extra-additional-actions
Adding additional options documentation for tables and relationships
2 parents 0ad7333 + d9e8772 commit 5df0250

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+203
-35
lines changed

docs/create-diagram.md

Lines changed: 96 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ The following databases are supported:
3939
- MSSQL
4040
- Oracle
4141

42-
For the moment the import SQL diagram has not been enabled for Oracle Data Base.
42+
You can import an existing SQL script to reverse engineer a diagram or start from scratch by picking the blank diagram option.
43+
44+
Additionally, it can be exported to any of the supported RDBMS.
4345

4446
<ThemedImage
4547
lightImageSrc={require("./img/light/pick-db.png").default}
@@ -57,6 +59,12 @@ Add tables either from the sidebar or the toolbar and define columns.
5759
alt="Define tables"
5860
/>
5961

62+
:::info
63+
64+
You can create attributes sequentially by pressing enter in the last field.
65+
66+
:::
67+
6068
### Table Fields
6169

6270
You can define the following fields for a column:
@@ -91,17 +99,48 @@ The check constraint will be injected into the SQL output as is.
9199

92100
:::
93101

102+
94103
:::info
95104

96-
You can create attributes sequentially by pressing enter in the last field.
105+
To define an attribute as primary key, select the checkbox with a key icon. If you want the attribute to be nullable or not nullable, select the checkbox with a question mark icon.
97106

98107
:::
99108

100-
:::info
109+
### More Functions on Tables
101110

102-
To define an attribute as primary key, select the checkbox with a key icon. If you want the attribute to be nullable or not nullable, select the checkbox with a question mark icon.
111+
- A primary key cannot be nullable.
103112

104-
:::
113+
<ThemedImage
114+
lightImageSrc={require("./img/light/pk_notnull.png").default}
115+
darkImageSrc={require("./img/dark/pk_notnull.png").default}
116+
alt="Primary key not null"
117+
/>
118+
119+
- Only generating a foreign key from a primary key or from a unique and not null attribute is allowed.
120+
121+
<ThemedImage
122+
lightImageSrc={require("./img/light/cannotFk.png").default}
123+
darkImageSrc={require("./img/dark/cannotFk.png").default}
124+
alt="Cannot create a foreign key"
125+
/>
126+
127+
- To increase the width of the table, place the cursor on the right edge of the table and then click and drag to adjust the width.
128+
129+
- Also when typing the name of an attribute, if it is too long and takes up more space than previously defined, the width of the table will automatically adjust to fit the new size of the attribute.
130+
131+
<ThemedImage
132+
lightImageSrc={require("./img/light/slideTable.gif").default}
133+
darkImageSrc={require("./img/dark/slideTable.gif").default}
134+
alt="Adjust table"
135+
/>
136+
137+
- In case you want to quickly find a table in a very large diagram, you can use the search bar located at the top of the tables tab in the left sidebar and then click on the table you want to find. This will open the table's configuration panel where there is a button to center the table in the viewport.
138+
139+
<ThemedImage
140+
lightImageSrc={require("./img/light/centerTable.gif").default}
141+
darkImageSrc={require("./img/dark/centerTable.gif").default}
142+
alt="Center table"
143+
/>
105144

106145
### Indexes
107146

@@ -123,19 +162,29 @@ To create a relationship and define foreign keys, long-press the blue dot on the
123162

124163
The gif shows one of three possible notations selectable in the modeler; for each notation, the rendering and some actions may change.
125164

126-
<!--If at some point you realize that the keys are flipped you can swap them from the `Relationships` tab. Open the relationship you'd like to edit, click on the more button (three dots) next to the primary and forign columns, and then swap. -->!
127165

128166
:::info
129167

130168
To delete the relationship, simply double-click on the relationship and select the delete button or delete the auto-generated foreign key from the table.
131169

132170
:::
133171

134-
:::info
135172

136-
To switch between identifying and non-identifying relationships, simply double-click, select the edit icon, or open the child table's configuration panel and modify the primary key attribute. If the foreign key is also part of the primary key, the relationship will be identifying; otherwise, it will be non-identifying.
173+
If at some point you realize that the keys are flipped you can swap them from the `Relationships` tab. Open the relationship you'd like to edit, click on the more button (three dots) next to the primary and forign columns, and then swap.!
137174

138-
:::
175+
<ThemedImage
176+
lightImageSrc={require("./img/light/swap-keys.gif").default}
177+
darkImageSrc={require("./img/dark/swap-keys.gif").default}
178+
alt="Swap keys"
179+
/>
180+
181+
<FAQ header="Why can't I swap the keys?">
182+
183+
If the child table does not contain a primary key, the exchange cannot be performed.
184+
185+
<ThemedImage lightImageSrc={require("./img/light/cannot_swap.png").default} darkImageSrc={require("./img/dark/cannot_swap.png").default} alt="invalid relationship" />
186+
187+
</FAQ>
139188

140189
You can define the following fields for a relationship:
141190

@@ -164,6 +213,42 @@ You can define the following fields for a relationship:
164213
- Set null
165214
- Set default
166215

216+
### Extra Options for Relationships
217+
218+
- To create a relationship the child table must not contain an attribute with the same name as the parent table's primary key.
219+
220+
<ThemedImage
221+
lightImageSrc={require("./img/light/attribute_exists.png").default}
222+
darkImageSrc={require("./img/dark/attribute_exists.png").default}
223+
alt="Attribute already exists"
224+
/>
225+
226+
- To define a relationship with a composite primary key, simply drag any of the parent table's primary keys to the child table. This will generate all the necessary foreign keys in the child table.
227+
228+
- To delete this type of relationship, simply delete any of the foreign keys generated in the child table, delete the relationship directly, or delete any of the primary keys involved.
229+
230+
<ThemedImage
231+
lightImageSrc={require("./img/light/composedPk.gif").default}
232+
darkImageSrc={require("./img/dark/composedPk.gif").default}
233+
alt="Composed pk relationship"
234+
/>
235+
236+
- To switch between identifying and non-identifying relationships, simply open the child table's configuration panel and modify the foreign key attribute. If the foreign key is also part of the primary key, the relationship will be identifying; otherwise, it will be non-identifying.
237+
238+
<ThemedImage
239+
lightImageSrc={require("./img/light/identifyingRelation.gif").default}
240+
darkImageSrc={require("./img/dark/identifyingRelation.gif").default}
241+
alt="Identifying relationship"
242+
/>
243+
244+
- To define optional or mandatory participation in a relationship, simply edit the child table and modify the foreign key attribute. If the foreign key is nullable, the participation will be optional; otherwise, it will be mandatory.
245+
246+
<ThemedImage
247+
lightImageSrc={require("./img/light/optionalParticipation.gif").default}
248+
darkImageSrc={require("./img/dark/optionalParticipation.gif").default}
249+
alt="Optional participation"
250+
/>
251+
167252
### Supertypes and Subtypes Entities
168253

169254
To create a relationship that uses this concept, you must first create a regular relationship, then go to its configuration panel and select the subtype in the relationship types section.
@@ -173,7 +258,7 @@ When you select it, the relationship's notation will change, and a blue dot will
173258
<ThemedImage
174259
lightImageSrc={require("./img/light/subtype-relationship.gif").default}
175260
darkImageSrc={require("./img/dark/subtype-relationship.gif").default}
176-
alt="Create a relationship"
261+
alt="Define subtypes"
177262
/>
178263

179264
:::info
@@ -189,7 +274,7 @@ In order to model Many to Many relationships you will need to use a join table.
189274

190275
A join table is a third table that contains foreign keys to the 2 tables you'd like to connect. Additionally, you can add any other relationship-specific columns to the table. For example:
191276

192-
<ThemedImage lightImageSrc={require("./img/light/many-to-many.png").default} darkImageSrc={require("./img/dark/many-to-many.png").default} alt="Pick a database" />
277+
<ThemedImage lightImageSrc={require("./img/light/many-to-many.png").default} darkImageSrc={require("./img/dark/many-to-many.png").default} alt="Many to Many Relationship" />
193278

194279
</FAQ>
195280

docs/how-it-works.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
sidebar_position: 8
2+
sidebar_position: 9
33
---
44

55
# How it works
66

7-
drawDB is a simple ReactJS app. Below is a high-level overview of how things are constructed but generally if you're wondering how something works, the first thing that comes to mind is most probably it.
7+
drawDB is a simple ReactJS app. Below is a high-level overview of how things are constructed but generally if you're wondering how something works, the first thing that comes to mind is most probably it.
88

99
## Editor canvas
1010

docs/img/dark/attribute_exists.png

98 KB
Loading

docs/img/dark/cannotFk.png

91.9 KB
Loading

docs/img/dark/cannot_swap.png

101 KB
Loading

docs/img/dark/centerTable.gif

762 KB
Loading

docs/img/dark/composedPk.gif

892 KB
Loading
800 KB
Loading
776 KB
Loading

docs/img/dark/pick-db.png

1.08 KB
Loading

0 commit comments

Comments
 (0)