@dbml/core 3.9.0 → 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.
|
@@ -220,9 +220,11 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
220
220
|
var _this2 = this;
|
|
221
221
|
var strArr = refIds.map(function (refId) {
|
|
222
222
|
var ref = model.refs[refId];
|
|
223
|
-
var
|
|
223
|
+
var oneRelationEndpointIndex = ref.endpointIds.findIndex(function (endpointId) {
|
|
224
224
|
return model.endpoints[endpointId].relation === '1';
|
|
225
225
|
});
|
|
226
|
+
var isManyToMany = oneRelationEndpointIndex === -1;
|
|
227
|
+
var refEndpointIndex = isManyToMany ? 0 : oneRelationEndpointIndex;
|
|
226
228
|
var foreignEndpointId = ref.endpointIds[1 - refEndpointIndex];
|
|
227
229
|
var refEndpointId = ref.endpointIds[refEndpointIndex];
|
|
228
230
|
var foreignEndpoint = model.endpoints[foreignEndpointId];
|
|
@@ -241,7 +243,7 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
241
243
|
var foreignEndpointTable = model.tables[foreignEndpointField.tableId];
|
|
242
244
|
var foreignEndpointSchema = model.schemas[foreignEndpointTable.schemaId];
|
|
243
245
|
var foreignEndpointFieldName = _this2.buildFieldName(foreignEndpoint.fieldIds, model, 'dbml');
|
|
244
|
-
if (foreignEndpoint.relation === '1') line += '- ';else line += '< ';
|
|
246
|
+
if (isManyToMany) line += '<> ';else if (foreignEndpoint.relation === '1') line += '- ';else line += '< ';
|
|
245
247
|
line += "".concat((0, _utils.shouldPrintSchema)(foreignEndpointSchema, model) ? "\"".concat(foreignEndpointSchema.name, "\".") : '', "\"").concat(foreignEndpointTable.name, "\".").concat(foreignEndpointFieldName);
|
|
246
248
|
var refActions = [];
|
|
247
249
|
if (ref.onUpdate) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/core",
|
|
3
|
-
"version": "3.9.
|
|
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.9.
|
|
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
|
}
|