@dbml/core 2.4.4 → 2.5.0
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.
- package/lib/model_structure/database.js +5 -2
- package/lib/model_structure/enum.js +2 -1
- package/lib/model_structure/enumValue.js +2 -1
- package/lib/model_structure/field.js +4 -3
- package/lib/model_structure/indexes.js +2 -1
- package/lib/model_structure/schema.js +2 -3
- package/lib/model_structure/table.js +2 -1
- package/lib/parse/dbml/parser.pegjs +12 -2
- package/lib/parse/dbmlParser.js +434 -428
- package/lib/parse/mssql/statements/actions.js +10 -6
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +23 -23
- package/lib/parse/mysql/parser.pegjs +5 -5
- package/lib/parse/mysqlParser.js +6 -2
- package/lib/parse/postgresParser.js +1 -1
- package/lib/parse/postgresql/parser.pegjs +2 -2
- package/package.json +2 -2
- package/types/.DS_Store +0 -0
- package/types/model_structure/database.d.ts +3 -2
- package/types/model_structure/element.d.ts +6 -0
- package/types/model_structure/enum.d.ts +3 -2
- package/types/model_structure/enumValue.d.ts +3 -2
- package/types/model_structure/field.d.ts +6 -2
- package/types/model_structure/indexes.d.ts +3 -2
- package/types/model_structure/schema.d.ts +3 -2
- package/types/model_structure/table.d.ts +3 -2
|
@@ -85,7 +85,8 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
85
85
|
|
|
86
86
|
_this.hasDefaultSchema = false;
|
|
87
87
|
_this.schemas = [];
|
|
88
|
-
_this.note = project.note;
|
|
88
|
+
_this.note = project.note ? project.note.value : null;
|
|
89
|
+
_this.noteToken = project.note ? project.note.token : null;
|
|
89
90
|
_this.databaseType = project.database_type;
|
|
90
91
|
_this.name = project.name;
|
|
91
92
|
_this.aliases = aliases; // The process order is important. Do not change !
|
|
@@ -190,7 +191,9 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
190
191
|
if (!schema) {
|
|
191
192
|
schema = new _schema["default"]({
|
|
192
193
|
name: schemaName,
|
|
193
|
-
note:
|
|
194
|
+
note: {
|
|
195
|
+
value: schemaName === _config.DEFAULT_SCHEMA_NAME ? "Default ".concat(_lodash["default"].capitalize(_config.DEFAULT_SCHEMA_NAME), " Schema") : null
|
|
196
|
+
},
|
|
194
197
|
database: this
|
|
195
198
|
});
|
|
196
199
|
this.pushSchema(schema);
|
|
@@ -60,7 +60,8 @@ var EnumValue = /*#__PURE__*/function (_Element) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
_this.name = name;
|
|
63
|
-
_this.note = note;
|
|
63
|
+
_this.note = note ? note.value : null;
|
|
64
|
+
_this.noteToken = note ? note.token : null;
|
|
64
65
|
_this._enum = _enum;
|
|
65
66
|
_this.dbState = _this._enum.dbState;
|
|
66
67
|
|
|
@@ -53,7 +53,7 @@ var Field = /*#__PURE__*/function (_Element) {
|
|
|
53
53
|
unique = _ref.unique,
|
|
54
54
|
pk = _ref.pk,
|
|
55
55
|
token = _ref.token,
|
|
56
|
-
|
|
56
|
+
notNull = _ref.not_null,
|
|
57
57
|
note = _ref.note,
|
|
58
58
|
dbdefault = _ref.dbdefault,
|
|
59
59
|
increment = _ref.increment,
|
|
@@ -77,8 +77,9 @@ var Field = /*#__PURE__*/function (_Element) {
|
|
|
77
77
|
_this.type = type;
|
|
78
78
|
_this.unique = unique;
|
|
79
79
|
_this.pk = pk;
|
|
80
|
-
_this.not_null =
|
|
81
|
-
_this.note = note;
|
|
80
|
+
_this.not_null = notNull;
|
|
81
|
+
_this.note = note ? note.value : null;
|
|
82
|
+
_this.noteToken = note ? note.token : null;
|
|
82
83
|
_this.dbdefault = dbdefault;
|
|
83
84
|
_this.increment = increment;
|
|
84
85
|
_this.endpoints = [];
|
|
@@ -64,7 +64,8 @@ var Index = /*#__PURE__*/function (_Element) {
|
|
|
64
64
|
_this.name = name;
|
|
65
65
|
_this.type = type;
|
|
66
66
|
_this.unique = unique;
|
|
67
|
-
_this.note = note;
|
|
67
|
+
_this.note = note ? note.value : null;
|
|
68
|
+
_this.noteToken = note ? note.token : null;
|
|
68
69
|
_this.pk = pk;
|
|
69
70
|
_this.columns = [];
|
|
70
71
|
_this.table = table;
|
|
@@ -11,8 +11,6 @@ var _element = _interopRequireDefault(require("./element"));
|
|
|
11
11
|
|
|
12
12
|
var _enum2 = _interopRequireDefault(require("./enum"));
|
|
13
13
|
|
|
14
|
-
var _config = require("./config");
|
|
15
|
-
|
|
16
14
|
var _utils = require("./utils");
|
|
17
15
|
|
|
18
16
|
var _tableGroup = _interopRequireDefault(require("./tableGroup"));
|
|
@@ -81,7 +79,8 @@ var Schema = /*#__PURE__*/function (_Element) {
|
|
|
81
79
|
_this.tableGroups = [];
|
|
82
80
|
_this.refs = [];
|
|
83
81
|
_this.name = name;
|
|
84
|
-
_this.note = note;
|
|
82
|
+
_this.note = note ? note.value : null;
|
|
83
|
+
_this.noteToken = note ? note.token : null;
|
|
85
84
|
_this.alias = alias;
|
|
86
85
|
_this.database = database;
|
|
87
86
|
_this.dbState = _this.database.dbState;
|
|
@@ -71,7 +71,8 @@ var Table = /*#__PURE__*/function (_Element) {
|
|
|
71
71
|
_this = _super.call(this, token);
|
|
72
72
|
_this.name = name;
|
|
73
73
|
_this.alias = alias;
|
|
74
|
-
_this.note = note;
|
|
74
|
+
_this.note = note ? note.value : null;
|
|
75
|
+
_this.noteToken = note ? note.token : null;
|
|
75
76
|
_this.headerColor = headerColor;
|
|
76
77
|
_this.fields = [];
|
|
77
78
|
_this.indexes = [];
|
|
@@ -556,9 +556,19 @@ IndexName
|
|
|
556
556
|
= "name:"i _ val:StringLiteral { return val.value }
|
|
557
557
|
ObjectNoteElement
|
|
558
558
|
= note: ObjectNote { return note }
|
|
559
|
-
/ "note"i _ "{" _ val:StringLiteral _ "}" {
|
|
559
|
+
/ "note"i _ "{" _ val:StringLiteral _ "}" {
|
|
560
|
+
return {
|
|
561
|
+
value: val.value,
|
|
562
|
+
token: location(),
|
|
563
|
+
}
|
|
564
|
+
}
|
|
560
565
|
ObjectNote
|
|
561
|
-
= "note:"i _ val:StringLiteral {
|
|
566
|
+
= "note:"i _ val:StringLiteral {
|
|
567
|
+
return {
|
|
568
|
+
value: val.value,
|
|
569
|
+
token: location(),
|
|
570
|
+
}
|
|
571
|
+
}
|
|
562
572
|
IndexType
|
|
563
573
|
= "type:"i _ val:(btree/hash) { return val }
|
|
564
574
|
RefInline
|