@dbml/core 3.8.1 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,8 +44,7 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
44
44
|
// Only safe chars, no simple quotes nor CR/LF
|
|
45
45
|
return "'".concat(newStr, "'");
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
newStr = newStr.replaceAll("'''", "\\'''");
|
|
47
|
+
newStr = newStr.replaceAll("'", "\\'");
|
|
49
48
|
newStr = newStr.replaceAll('\r\n', '\n'); // turn all CRLF to LF
|
|
50
49
|
return "'''".concat(newStr, "'''");
|
|
51
50
|
}
|
|
@@ -221,9 +220,11 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
221
220
|
var _this2 = this;
|
|
222
221
|
var strArr = refIds.map(function (refId) {
|
|
223
222
|
var ref = model.refs[refId];
|
|
224
|
-
var
|
|
223
|
+
var oneRelationEndpointIndex = ref.endpointIds.findIndex(function (endpointId) {
|
|
225
224
|
return model.endpoints[endpointId].relation === '1';
|
|
226
225
|
});
|
|
226
|
+
var isManyToMany = oneRelationEndpointIndex === -1;
|
|
227
|
+
var refEndpointIndex = isManyToMany ? 0 : oneRelationEndpointIndex;
|
|
227
228
|
var foreignEndpointId = ref.endpointIds[1 - refEndpointIndex];
|
|
228
229
|
var refEndpointId = ref.endpointIds[refEndpointIndex];
|
|
229
230
|
var foreignEndpoint = model.endpoints[foreignEndpointId];
|
|
@@ -242,7 +243,7 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
242
243
|
var foreignEndpointTable = model.tables[foreignEndpointField.tableId];
|
|
243
244
|
var foreignEndpointSchema = model.schemas[foreignEndpointTable.schemaId];
|
|
244
245
|
var foreignEndpointFieldName = _this2.buildFieldName(foreignEndpoint.fieldIds, model, 'dbml');
|
|
245
|
-
if (foreignEndpoint.relation === '1') line += '- ';else line += '< ';
|
|
246
|
+
if (isManyToMany) line += '<> ';else if (foreignEndpoint.relation === '1') line += '- ';else line += '< ';
|
|
246
247
|
line += "".concat((0, _utils.shouldPrintSchema)(foreignEndpointSchema, model) ? "\"".concat(foreignEndpointSchema.name, "\".") : '', "\"").concat(foreignEndpointTable.name, "\".").concat(foreignEndpointFieldName);
|
|
247
248
|
var refActions = [];
|
|
248
249
|
if (ref.onUpdate) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Holistics <dev@holistics.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prepublish": "npm run build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@dbml/parse": "^3.
|
|
35
|
+
"@dbml/parse": "^3.9.1",
|
|
36
36
|
"antlr4": "^4.13.1",
|
|
37
37
|
"lodash": "^4.17.15",
|
|
38
38
|
"parsimmon": "^1.13.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"\\.(?!json$)[^.]*$": "@glen/jest-raw-loader"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "8494c278b97347945cf3b71d6f75cd658dbae85d",
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=16"
|
|
65
65
|
}
|