Skip to content

Commit 433663e

Browse files
Re: Mike object prefix double undescore
1 parent 455a533 commit 433663e

File tree

8 files changed

+101
-9
lines changed

8 files changed

+101
-9
lines changed

dist/quick-erd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ class de {
739739
e.rearrangeDiagram(3, !1), this.paperScroller.centerContent();
740740
}
741741
}
742-
const ue = "1.2.5", fe = {
742+
const ue = "1.2.6", fe = {
743743
Diagram: de,
744744
version: ue
745745
};

dist/quick-erd.umd.cjs

+1-1
Large diffs are not rendered by default.

dist/quick-sql.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9035,7 +9035,7 @@ const j = {
90359035
var p = this.getOptionValue("schema");
90369036
p == null && (p = ""), p != "" && b == null ? p = p + "." : p = "";
90379037
var M = "";
9038-
return this.getOptionValue("prefix") != null && (M = this.getOptionValue("prefix")), p = p + M, M != "" && (p = p + "_"), p.toLowerCase();
9038+
return this.getOptionValue("prefix") != null && (M = this.getOptionValue("prefix")), p = p + M, M != "" && !M.endsWith("_") && (p = p + "_"), p.toLowerCase();
90399039
};
90409040
let D = "";
90419041
0 < w.toLowerCase().indexOf("overridesettings") && ue(this), B != null && this.optionEQvalue("overrideSettings", !1) && (D = "# settings = " + B + `
@@ -9193,7 +9193,7 @@ function Ee(d, h) {
91939193
return new Y(d, h).getErrors();
91949194
}
91959195
function le() {
9196-
return "1.2.5";
9196+
return "1.2.6";
91979197
}
91989198
Y.version = le;
91999199
Y.toDDL = Pe;

dist/quick-sql.umd.cjs

+2-2
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@oracle/quicksql",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "Quick SQL to DDL and ERD translator",
55
"main": "./dist/quick-sql.umd.cjs",
66
"module": "./dist/quick-sql.js",

src/ddl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export const quicksql = (function () {
226226
if( this.getOptionValue('prefix') != null )
227227
value = this.getOptionValue('prefix');
228228
ret = ret + value;
229-
if( value != '' )
229+
if( value != '' && !value.endsWith('_') )
230230
ret = ret + '_';
231231
return ret.toLowerCase();
232232
};

test/experimental/competition1.qsql

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
Identify tables with maximumb number of foregn keys:
3+
submision,
4+
cahllenges,
5+
scores.
6+
Notice the referential integrity chain: scores > submissions > challenges.
7+
Choose the scores as the root node of snowflake schema.
8+
9+
scores
10+
challenge_id /fk competitions -- ?
11+
submission_id /fk submissions
12+
arbiter_id /fk arbiters
13+
score num
14+
comments
15+
*/
16+
17+
18+
/*
19+
Inline the /fk references
20+
*/
21+
22+
scores
23+
---!!---challenge_id /fk competitions
24+
--submission_id /fk submissions
25+
--arbiter_id /fk arbiters
26+
score num
27+
comments
28+
> arbiters
29+
--arbiter_id /fk persons
30+
expertise
31+
persons
32+
first_name
33+
last_name
34+
contactinfo
35+
> submissions
36+
team_id /fk teams
37+
--challenge_id /fk challenges
38+
content
39+
--status /fk submission_statuses
40+
MaxScore num
41+
--submission_type /fk submission_types
42+
> teams
43+
name
44+
contactinfo
45+
status /fk team_statuses
46+
description
47+
team_members -- not many2one!
48+
person_id /fk persons
49+
> submission_types
50+
name
51+
description
52+
> submission_statuses
53+
name
54+
description
55+
> challenges
56+
title
57+
description
58+
image blob
59+
status /fk challenge_statuses
60+
--competition_id /fk competitions
61+
--challenge_type /fk challenge_types
62+
> challenge_types
63+
name
64+
description
65+
> challenge_statuses
66+
name
67+
description
68+
> competitions
69+
name
70+
description
71+
start_datetime
72+
end_datetime
73+
--status /fk competition_statuses
74+
location vc255
75+
--oraganizer_id /fk organizers
76+
competition_statuses
77+
name
78+
description
79+
> organizers
80+
name
81+
contactinfo
82+
description
83+
84+

test/small_tests.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,18 @@ students
616616
ename
617617
`).getDDL();
618618

619-
//console.log(output);
620619
assert( "0 < output.indexOf('dept_id number')" );
621620
assert( "0 < output.indexOf('constraint emp_dept_id_fk')" );
622621
assert( "0 < output.indexOf('references dept on delete set null')" );
622+
623+
output = new quicksql(`dept
624+
dname
625+
# settings = {"prefix": "abc_"}
626+
`).getDDL();
627+
628+
//console.log(output);
629+
assert( "0 < output.indexOf('abc_dept')" );
630+
assert( "output.indexOf('abc__dept') < 0 " );
623631

624632
}
625633

0 commit comments

Comments
 (0)