@dbml/connector 6.4.0-alpha.0 → 6.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/dist/index.mjs CHANGED
@@ -702,17 +702,19 @@ var getValidatedClient$2 = async (t) => {
702
702
  `, c = await e.query(s), l = {};
703
703
  return c.recordset.forEach((e) => {
704
704
  let { table_schema: t, table_name: n, column_name: r, check_name: i, check_expression: a } = e, s = `${t}.${n}`;
705
- if (r) {
706
- o[s] || (o[s] = {}), o[s][r] || (o[s][r] = { checks: [] }), o[s][r].checks.push({
705
+ if (a) {
706
+ if (r) {
707
+ o[s] || (o[s] = {}), o[s][r] || (o[s][r] = { checks: [] }), o[s][r].checks.push({
708
+ name: i,
709
+ expression: a.slice(1, -1)
710
+ });
711
+ return;
712
+ }
713
+ l[s] || (l[s] = []), l[s].push({
707
714
  name: i,
708
715
  expression: a.slice(1, -1)
709
716
  });
710
- return;
711
717
  }
712
- l[s] || (l[s] = []), l[s].push({
713
- name: i,
714
- expression: a.slice(1, -1)
715
- });
716
718
  }), {
717
719
  indexes: a,
718
720
  tableConstraints: o,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@dbml/connector",
4
- "version": "6.4.0-alpha.0",
4
+ "version": "6.5.0",
5
5
  "description": "This package was created to fetch the schema JSON from many kind of databases.",
6
6
  "author": "huy.phung.sw@gmail.com",
7
7
  "license": "MIT",
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=18"
40
40
  },
41
- "gitHead": "ba26cc72483183193335e053d122c28d0aa13575"
41
+ "gitHead": "9ed15e01a00d4f58564ccdfb75f2f85bf5de5199"
42
42
  }
@@ -528,6 +528,7 @@ const generateIndexesAndConstraints = async (client: sql.ConnectionPool, schemas
528
528
  check_expression,
529
529
  } = row;
530
530
  const key = `${table_schema}.${table_name}`;
531
+ if (!check_expression) return;
531
532
  if (column_name) {
532
533
  if (!tableConstraints[key]) tableConstraints[key] = {};
533
534
  if (!tableConstraints[key][column_name]) tableConstraints[key][column_name] = { checks: [] };