@dbml/core
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -18,2 +18,4 @@ "use strict"; | ||
var _tableGroup = _interopRequireDefault(require("./tableGroup")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -38,4 +40,5 @@ | ||
function () { | ||
function Schema(_ref) { | ||
var _ref$tables = _ref.tables, | ||
function Schema() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$tables = _ref.tables, | ||
tables = _ref$tables === void 0 ? [] : _ref$tables, | ||
@@ -45,3 +48,5 @@ _ref$enums = _ref.enums, | ||
_ref$refs = _ref.refs, | ||
refs = _ref$refs === void 0 ? [] : _ref$refs; | ||
refs = _ref$refs === void 0 ? [] : _ref$refs, | ||
_ref$tableGroups = _ref.tableGroups, | ||
tableGroups = _ref$tableGroups === void 0 ? [] : _ref$tableGroups; | ||
@@ -52,3 +57,4 @@ _classCallCheck(this, Schema); | ||
this.tables = []; | ||
this.enums = []; // The process order is important. Do not change ! | ||
this.enums = []; | ||
this.tableGroups = []; // The process order is important. Do not change ! | ||
@@ -58,2 +64,3 @@ this.processTables(tables); | ||
this.processEnums(enums); | ||
this.processTableGroups(tableGroups); | ||
} | ||
@@ -98,5 +105,14 @@ | ||
}, { | ||
key: "processTableGroups", | ||
value: function processTableGroups(rawTableGroups) { | ||
var _this4 = this; | ||
rawTableGroups.forEach(function (tableGroup) { | ||
_this4.pushTableGroup(new _tableGroup["default"](tableGroup)); | ||
}); | ||
} | ||
}, { | ||
key: "bindEnumRefToFields", | ||
value: function bindEnumRefToFields() { | ||
var _this4 = this; | ||
var _this5 = this; | ||
@@ -110,3 +126,3 @@ var keywordString = "by|bool|boolean|bit|blob|decimal|double|enum|float|long\n |longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob\n |tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4\n |float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year\n |unsigned|signed|numeric|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl"; | ||
})) { | ||
var _enum = _lodash["default"].find(_this4.enums, function (e) { | ||
var _enum = _lodash["default"].find(_this5.enums, function (e) { | ||
return e.name === field.type.type_name; | ||
@@ -145,2 +161,9 @@ }); | ||
}, { | ||
key: "pushTableGroup", | ||
value: function pushTableGroup(tableGroup) { | ||
this.checkTableGroup(tableGroup); | ||
tableGroup.processTableNames(this); | ||
this.tableGroups.push(tableGroup); | ||
} | ||
}, { | ||
key: "checkEnum", | ||
@@ -173,2 +196,11 @@ value: function checkEnum(_enum) { | ||
}, { | ||
key: "checkTableGroup", | ||
value: function checkTableGroup(tableGroup) { | ||
if (this.tableGroups.some(function (tg) { | ||
return tg.name === tableGroup.name; | ||
})) { | ||
tableGroup.error("Table Group named ".concat(tableGroup.name, " existed")); | ||
} | ||
} | ||
}, { | ||
key: "findTable", | ||
@@ -175,0 +207,0 @@ value: function findTable(tableName) { |
@@ -140,2 +140,7 @@ "use strict"; | ||
}, { | ||
key: "checkSameId", | ||
value: function checkSameId(table) { | ||
return this.name === table.name || this.alias === table.name || this.name === table.alias || this.alias && this.alias === table.alias; | ||
} | ||
}, { | ||
key: "export", | ||
@@ -142,0 +147,0 @@ value: function _export() { |
{ | ||
"name": "@dbml/core", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "> TODO: description", | ||
@@ -56,3 +56,3 @@ "author": "Holistics <dev@holistics.io>", | ||
}, | ||
"gitHead": "54f59deb69df710f839f26652e4c655853d59ebb" | ||
"gitHead": "afc03cacd1f1a2ee99c3f4ca5246b6228062cc3c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
860044
51
17977