|
1 | | -# QuickSQL |
| 1 | +# Quick SQL <!-- omit in toc --> |
2 | 2 |
|
3 | | -<!-- TOC --> |
| 3 | +## Table of Contents <!-- omit in toc --> |
4 | 4 |
|
5 | | -- [QuickSQL](#quicksql) |
6 | | - - [Overview](#overview) |
7 | | - - [Installation](#installation) |
8 | | - - [Building Locally](#building-locally) |
9 | | - - [Running Tests](#running-tests) |
10 | | - - [Running the Example CLI](#running-the-example-cli) |
11 | | - - [Translating QSQL into Oracle SQL Data Definition Language (DDL)](#translating-qsql-into-oracle-sql-data-definition-language-ddl) |
| 5 | +- [Overview](#overview) |
| 6 | +- [Installation](#installation) |
| 7 | +- [Building Locally](#building-locally) |
| 8 | +- [Running Tests](#running-tests) |
| 9 | +- [Running the Example CLI](#running-the-example-cli) |
| 10 | +- [Translating Quick SQL into Oracle SQL Data Definition Language (DDL)](#translating-quick-sql-into-oracle-sql-data-definition-language-ddl) |
12 | 11 | - [DDL NodeJS ECMA Script Module (ESM) Example](#ddl-nodejs-ecma-script-module-esm-example) |
13 | 12 | - [DDL NodeJS Common JS (CJS) Example](#ddl-nodejs-common-js-cjs-example) |
14 | 13 | - [DDL Browser ECMA Script Module (ESM) Example](#ddl-browser-ecma-script-module-esm-example) |
15 | 14 | - [DDL Browser Universal Module Definition (UMD) Example](#ddl-browser-universal-module-definition-umd-example) |
16 | | - - [Transforming Quick SQL into an Entity-Relationship Diagram (ERD)](#transforming-quick-sql-into-an-entity-relationship-diagram-erd) |
17 | | - - [Prerequisites](#prerequisites) |
18 | | - - [ERD Browser ESM Example](#erd-browser-esm-example) |
19 | | - - [ERD Browser UMD Example](#erd-browser-umd-example) |
20 | | - - [ERD Theming](#erd-theming) |
21 | | - - [Contributing](#contributing) |
22 | | - - [Security](#security) |
23 | | - - [License](#license) |
24 | | - |
25 | | -<!-- /TOC --> |
26 | | - |
| 15 | +- [Transforming Quick SQL into an Entity-Relationship Diagram (ERD)](#transforming-quick-sql-into-an-entity-relationship-diagram-erd) |
| 16 | +- [Contributing](#contributing) |
| 17 | +- [Security](#security) |
| 18 | +- [License](#license) |
27 | 19 |
|
28 | 20 | ## Overview |
29 | 21 |
|
30 | | -Quick SQL (QSQL) is a markdown-like shorthand syntax that expands to standards-based |
| 22 | +Quick SQL is a markdown-like shorthand syntax that expands to standards-based |
31 | 23 | Oracle SQL. It is useful to rapidly design and prototype data models. Take a |
32 | 24 | look at the example below: |
33 | 25 |
|
34 | 26 |  |
35 | 27 |
|
36 | 28 | Previously, Quick SQL was only available within Oracle Application Express. This |
37 | | -project reimplements the QSQL parser and translator into a JavaScript |
| 29 | +project reimplements the Quick SQL parser and translator into a JavaScript |
38 | 30 | library which can be used in both NodeJS and the browser. |
39 | 31 |
|
40 | | -This repository also includes a QSQL to Entity Relationship Diagram |
| 32 | +This repository also includes a Quick SQL to Entity Relationship Diagram |
41 | 33 | module that can be used as seen in the example below: |
42 | 34 |
|
43 | 35 |  |
@@ -77,12 +69,12 @@ Once you have built the library, you can run the example CLI by executing: |
77 | 69 | npm run example-cli -- ./test/department_employees.quicksql |
78 | 70 | ``` |
79 | 71 |
|
80 | | -## Translating QSQL into Oracle SQL Data Definition Language (DDL) |
| 72 | +## Translating Quick SQL into Oracle SQL Data Definition Language (DDL) |
81 | 73 |
|
82 | | -The QSQL to DDL translator is the product's core component, It allows users |
83 | | -to transform a QSQL string into an Oracle SQL string. |
| 74 | +The Quick SQL to DDL translator is the product's core component, It allows users |
| 75 | +to transform a Quick SQL string into an Oracle SQL string. |
84 | 76 |
|
85 | | -The Quick SQL Syntax is documented [here](./doc/quicksql.md) |
| 77 | +The Quick SQL Syntax and Grammar are documented [here](./doc/quick-sql-grammar.md) |
86 | 78 |
|
87 | 79 | See below for examples of how to use this library. |
88 | 80 |
|
@@ -168,203 +160,17 @@ view emp_v departments employees |
168 | 160 |
|
169 | 161 | ## Transforming Quick SQL into an Entity-Relationship Diagram (ERD) |
170 | 162 |
|
171 | | -### Prerequisites |
172 | | -
|
173 | | -You need to add the following dependencies to your HTML: |
174 | | -
|
175 | | -- JointJS+ v3.5.0 (Requires a paid License). This requires the following |
176 | | - dependencies (See the [JointJS+ |
177 | | - Documentation](https://resources.jointjs.com/docs/rappid/v3.5/index.html)): |
178 | | -
|
179 | | - - jQuery |
180 | | - - lodash |
181 | | - - Backbone JS |
182 | | -
|
183 | | -### ERD Browser ESM Example |
184 | | -
|
185 | | -<!-- markdownlint-disable MD013 --> |
186 | | -```html |
187 | | -<!DOCTYPE html> |
188 | | -<html> |
189 | | - <head> |
190 | | - <meta charset="UTF-8"> |
191 | | - <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
192 | | - <title>Quick ERD</title> |
193 | | -
|
194 | | - <!-- Assuming you put the rappid.min.css file in this path --> |
195 | | - <link rel="stylesheet" type="text/css" href="./examples/diagram-generator/libs/rappid.min.css"> |
196 | | - <link rel="stylesheet" href="./dist/quick-erd.css"> |
197 | | -
|
198 | | - <style> |
199 | | - html, body { |
200 | | - height: 100%; |
201 | | - margin: 0; |
202 | | - } |
203 | | - #quickERD { |
204 | | - width: 100%; |
205 | | - height: 100%; |
206 | | - } |
207 | | - </style> |
208 | | - </head> |
209 | | - <body> |
210 | | - <div id="quickERD"></div> |
211 | | -
|
212 | | - <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
213 | | - <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js" integrity="sha256-qXBd/EfAdjOA2FGrGAG+b3YBn2tn5A6bhz+LSgYD96k=" crossorigin="anonymous"></script> |
214 | | - <script src="https://cdn.jsdelivr.net/npm/backbone@1.5.0/backbone-min.min.js"></script> |
215 | | -
|
216 | | - <!-- Assuming you put the rappid.min.js file in this path --> |
217 | | - <script src="./examples/diagram-generator/libs/rappid.min.js"></script> |
218 | | -
|
219 | | - <script type="module"> |
220 | | - import { toERD } from './dist/quick-sql.js'; |
221 | | - import { Diagram } from './dist/quick-erd.js'; |
222 | | -
|
223 | | - new Diagram( toERD( |
224 | | -` |
225 | | -departments |
226 | | - name /nn |
227 | | - location |
228 | | - country |
229 | | -employees |
230 | | - departments_id /fk departments |
231 | | - name /nn vc50 |
232 | | - email /lower |
233 | | - cost center num |
234 | | - date hired |
235 | | - job vc255 |
236 | | -
|
237 | | -view emp_v departments employees |
238 | | -
|
239 | | -# settings = { "prefix": null, "semantics": "CHAR", "DV": false } |
240 | | -
|
241 | | -` |
242 | | - ), '#quickERD' ); |
243 | | - </script> |
244 | | - </body> |
245 | | -</html> |
246 | | -``` |
247 | | -<!-- markdownlint-enable MD013 --> |
248 | | - |
249 | | -### ERD Browser UMD Example |
250 | | - |
251 | | -<!-- markdownlint-disable MD013 --> |
252 | | -```html |
253 | | -<!DOCTYPE html> |
254 | | -<html> |
255 | | - <head> |
256 | | - <meta charset="UTF-8"> |
257 | | - <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
258 | | - <title>Quick ERD</title> |
259 | | - |
260 | | - <!-- Assuming you put the rappid.min.css file in this path --> |
261 | | - <link rel="stylesheet" type="text/css" href="./examples/diagram-generator/libs/rappid.min.css"> |
262 | | - <link rel="stylesheet" href="./dist/quick-erd.css"> |
263 | | - |
264 | | - <style> |
265 | | - html, body { |
266 | | - height: 100%; |
267 | | - margin: 0; |
268 | | - } |
269 | | - #quickERD { |
270 | | - width: 100%; |
271 | | - height: 100%; |
272 | | - } |
273 | | - </style> |
274 | | - </head> |
275 | | - <body> |
276 | | - <div id="quickERD"></div> |
277 | | - |
278 | | - <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
279 | | - <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js" integrity="sha256-qXBd/EfAdjOA2FGrGAG+b3YBn2tn5A6bhz+LSgYD96k=" crossorigin="anonymous"></script> |
280 | | - <script src="https://cdn.jsdelivr.net/npm/backbone@1.5.0/backbone-min.min.js"></script> |
281 | | - |
282 | | - <!-- Assuming you put the rappid.min.js file in this path --> |
283 | | - <script src="./examples/diagram-generator/libs/rappid.min.js"></script> |
284 | | - |
285 | | - <script src="./dist/quick-sql.umd.cjs"></script> |
286 | | - <script src="./dist/quick-erd.umd.cjs"></script> |
287 | | - |
288 | | - <script> |
289 | | - new quickERD.Diagram( quickSQL.toERD( |
290 | | -` |
291 | | -departments |
292 | | - name /nn |
293 | | - location |
294 | | - country |
295 | | -employees |
296 | | - departments_id /fk departments |
297 | | - name /nn vc50 |
298 | | - email /lower |
299 | | - cost center num |
300 | | - date hired |
301 | | - job vc255 |
302 | | -
|
303 | | -view emp_v departments employees |
304 | | -
|
305 | | -# settings = { "prefix": null, "semantics": "CHAR", "DV": false } |
306 | | -
|
307 | | -` |
308 | | - ), '#quickERD' ); |
309 | | - </script> |
310 | | - </body> |
311 | | -</html> |
312 | | -``` |
313 | | -<!-- markdownlint-enable MD013 --> |
314 | | - |
315 | | -### ERD Theming |
316 | | - |
317 | | -By default, the diagram uses a neutral color scheme as per below: |
318 | | - |
319 | | - |
320 | | - |
321 | | -However, the diagram can be themed using CSS variables as shown in the example below: |
322 | | - |
323 | | -```css |
324 | | -/* Light Theme */ |
325 | | -:root { |
326 | | - --qs-diagram-table-background-color: #FFF; |
327 | | - --qs-diagram-font-family: var(--a-base-font-family, sans-serif); |
328 | | - --qs-diagram-table-border-color: #f1efed; |
329 | | - --qs-diagram-table-name-text-color: rgb(22 21 19); |
330 | | - --qs-diagram-table-column-text-color: rgba(22, 21, 19, .9); |
331 | | - --qs-diagram-table-data-type-text-color: rgba(22, 21, 19, .5); |
332 | | - --qs-diagram-table-separator-color: #e7e3e1; |
333 | | -} |
334 | | -/* Dark Theme */ |
335 | | -@media (prefers-color-scheme: dark) { |
336 | | - :root { |
337 | | - --qs-diagram-table-background-color: #4a4541; |
338 | | - --qs-diagram-font-family: var(--a-base-font-family, sans-serif); |
339 | | - --qs-diagram-table-border-color: #55504c; |
340 | | - --qs-diagram-table-text-color: #fcfbfa; |
341 | | - --qs-diagram-table-name-text-color: white; |
342 | | - --qs-diagram-table-column-text-color: rgb(255 255 255 / 90%); |
343 | | - --qs-diagram-table-data-type-text-color: rgb(255 255 255 / 60%); |
344 | | - --qs-diagram-table-separator-color: #55504c; |
345 | | - } |
346 | | -} |
347 | | -``` |
348 | | - |
349 | | -Which would produce the following: |
350 | | - |
351 | | -- Light Color Scheme |
352 | | - |
353 | | -  |
354 | | - |
355 | | -- Dark Color Scheme |
356 | | - |
357 | | -  |
358 | | - |
| 163 | +Requires a paid library. Review the usage [here](./doc/quick-erd.md) |
359 | 164 |
|
360 | 165 | ## Contributing |
361 | 166 |
|
362 | | - |
363 | | -This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md) |
| 167 | +This project welcomes contributions from the community. Before submitting a pull |
| 168 | +request, please [review our contribution guide](./CONTRIBUTING.md) |
364 | 169 |
|
365 | 170 | ## Security |
366 | 171 |
|
367 | | -Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process |
| 172 | +Please consult the [security guide](./SECURITY.md) for our responsible security |
| 173 | +vulnerability disclosure process |
368 | 174 |
|
369 | 175 | ## License |
370 | 176 |
|
|
0 commit comments