@dbml/core 5.0.0 → 5.1.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.
@@ -50,7 +50,8 @@ var createFields = function createFields(rawFields, fieldsConstraints) {
50
50
  increment: field.increment,
51
51
  pk: constraints.pk || field.pk,
52
52
  unique: constraints.unique || field.unique,
53
- note: field.note
53
+ note: field.note,
54
+ checks: constraints.checks
54
55
  });
55
56
  return f;
56
57
  });
@@ -72,7 +73,7 @@ var createIndexes = function createIndexes(rawIndexes) {
72
73
  return index;
73
74
  });
74
75
  };
75
- var createTables = function createTables(rawTables, rawFields, rawIndexes, tableConstraints) {
76
+ var createTables = function createTables(rawTables, rawFields, rawIndexes, rawTableChecks, tableConstraints) {
76
77
  return rawTables.map(function (rawTable) {
77
78
  var name = rawTable.name,
78
79
  schemaName = rawTable.schemaName,
@@ -86,7 +87,8 @@ var createTables = function createTables(rawTables, rawFields, rawIndexes, table
86
87
  schemaName: schemaName,
87
88
  fields: fields,
88
89
  indexes: indexes,
89
- note: note
90
+ note: note,
91
+ checks: rawTableChecks[key]
90
92
  });
91
93
  });
92
94
  };
@@ -96,9 +98,10 @@ var generateDatabase = exports.generateDatabase = function generateDatabase(sche
96
98
  rawIndexes = schemaJson.indexes,
97
99
  rawRefs = schemaJson.refs,
98
100
  rawEnums = schemaJson.enums,
99
- tableConstraints = schemaJson.tableConstraints;
101
+ tableConstraints = schemaJson.tableConstraints,
102
+ rawTableChecks = schemaJson.checks;
100
103
  try {
101
- var tables = createTables(rawTables, rawFields, rawIndexes, tableConstraints);
104
+ var tables = createTables(rawTables, rawFields, rawIndexes, rawTableChecks, tableConstraints);
102
105
  var enums = createEnums(rawEnums);
103
106
  var refs = createRefs(rawRefs);
104
107
  var rawDatabase = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/core",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
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": "^5.0.0",
35
+ "@dbml/parse": "^5.1.0",
36
36
  "antlr4": "^4.13.1",
37
37
  "lodash": "^4.17.15",
38
38
  "parsimmon": "^1.13.0",
@@ -62,7 +62,7 @@
62
62
  "^lodash-es$": "lodash"
63
63
  }
64
64
  },
65
- "gitHead": "a2d029e9c3c78ab0956312495165ec3115b5bc00",
65
+ "gitHead": "376dca507512a3fe549f630e6f22d7d339939183",
66
66
  "engines": {
67
67
  "node": ">=16"
68
68
  }