@dbml/cli 8.0.0-alpha.2 → 8.0.0-alpha.4

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.
Files changed (29) hide show
  1. package/__tests__/db2dbml/mssql/dbml-error.log +10 -0
  2. package/__tests__/db2dbml/mysql/dbml-error.log +13 -0
  3. package/__tests__/db2dbml/oracle/dbml-error.log +14 -0
  4. package/__tests__/db2dbml/postgres/dbml-error.log +14 -0
  5. package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  6. package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +1 -1
  7. package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  8. package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  9. package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  10. package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +1 -1
  11. package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  12. package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  13. package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  14. package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  15. package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +1 -1
  16. package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  17. package/__tests__/dbml2sql/syntax-error/dbml-error.log +10 -0
  18. package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +8 -0
  19. package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +8 -0
  20. package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +8 -0
  21. package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +8 -0
  22. package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +8 -0
  23. package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +8 -0
  24. package/__tests__/sql2dbml/syntax-error/dbml-error.log +8 -0
  25. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +8 -0
  26. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +4 -0
  27. package/lib/index.js +8 -6
  28. package/package.json +4 -4
  29. package/src/helpers/logger.ts +2 -2
@@ -358,3 +358,13 @@ ConnectionError: Login failed for user 'SA'.
358
358
  at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
359
359
  at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
360
360
 
361
+ 2026-05-06T10:17:43.520Z
362
+ ConnectionError: Login failed for user 'SA'.
363
+ at /home/huydna/projects/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
364
+ at Connection.onConnect (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:849:9)
365
+ at Object.onceWrapper (node:events:634:26)
366
+ at Connection.emit (node:events:519:28)
367
+ at Connection.emit (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:970:18)
368
+ at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
369
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
370
+
@@ -466,3 +466,16 @@ Error: Unknown database 'dbml_test'
466
466
  at Object..js (node:internal/modules/cjs/loader:1839:10)
467
467
  at Module.load (node:internal/modules/cjs/loader:1441:32)
468
468
 
469
+ 2026-05-06T10:17:44.739Z
470
+ Error: Unknown database 'dbml_test'
471
+ at c (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:47740)
472
+ at Fr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:52036)
473
+ at Xr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3360:500)
474
+ at Module.Hi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3739:1082)
475
+ at connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:55)
476
+ at Module.db2dbml (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1394:2)
477
+ at Object.<anonymous> (/home/huydna/projects/dbml/packages/dbml-cli/bin/db2dbml.js:3:19)
478
+ at Module._compile (node:internal/modules/cjs/loader:1706:14)
479
+ at Object..js (node:internal/modules/cjs/loader:1839:10)
480
+ at Module.load (node:internal/modules/cjs/loader:1441:32)
481
+
@@ -502,3 +502,17 @@ connect ECONNREFUSED 127.0.0.1:1521
502
502
  at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
503
503
  at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
504
504
 
505
+ 2026-05-06T10:17:45.991Z
506
+ Error: NJS-503: connection to host 127.0.0.1 port 1521 could not be established. (CONNECTION_ID=KhaaLMFAF4Xr6LtuRWS10w==)
507
+ connect ECONNREFUSED 127.0.0.1:1521
508
+ at Object.throwErr (/home/huydna/projects/dbml/node_modules/oracledb/lib/errors.js:776:10)
509
+ at NTTCP.ntConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:206:16)
510
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
511
+ at async NTTCP.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:222:7)
512
+ at async NetworkSession.transportConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:182:5)
513
+ at async NetworkSession.connect2 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:222:7)
514
+ at async NetworkSession.connect1 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:336:23)
515
+ at async NetworkSession.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:623:5)
516
+ at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
517
+ at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
518
+
@@ -250,3 +250,17 @@ Error: PostgreSQL connection error: error: role "dbml" does not exist
250
250
  at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
251
251
  at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1168:22)
252
252
 
253
+ 2026-05-06T08:32:33.059Z
254
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
255
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
256
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
257
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
258
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
259
+
260
+ 2026-05-06T10:17:47.199Z
261
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
262
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
263
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
264
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
265
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
266
+
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2026-05-06T08:18:15.131Z
3
+ -- Generated at: 2026-05-06T10:16:33.450Z
4
4
 
5
5
  CREATE TABLE `orders` (
6
6
  `id` int PRIMARY KEY AUTO_INCREMENT,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2026-05-06T08:18:17.472Z
3
+ -- Generated at: 2026-05-06T10:16:35.997Z
4
4
 
5
5
  CREATE TABLE "orders" (
6
6
  "id" int GENERATED AS IDENTITY PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:19.831Z
3
+ -- Generated at: 2026-05-06T10:16:38.485Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:21.053Z
3
+ -- Generated at: 2026-05-06T10:16:39.793Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2026-05-06T08:18:24.506Z
3
+ -- Generated at: 2026-05-06T10:16:43.575Z
4
4
 
5
5
  CREATE TABLE `staff` (
6
6
  `id` int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2026-05-06T08:18:26.875Z
3
+ -- Generated at: 2026-05-06T10:16:45.999Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:29.254Z
3
+ -- Generated at: 2026-05-06T10:16:48.454Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:30.451Z
3
+ -- Generated at: 2026-05-06T10:16:49.698Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: SQL Server
3
- -- Generated at: 2026-05-06T08:18:35.192Z
3
+ -- Generated at: 2026-05-06T10:16:55.732Z
4
4
 
5
5
  CREATE SCHEMA [schemaB]
6
6
  GO
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2026-05-06T08:18:36.389Z
3
+ -- Generated at: 2026-05-06T10:16:56.929Z
4
4
 
5
5
  CREATE SCHEMA `schemaB`;
6
6
 
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2026-05-06T08:18:37.575Z
3
+ -- Generated at: 2026-05-06T10:16:58.141Z
4
4
 
5
5
  CREATE USER "C##test01"
6
6
  NO AUTHENTICATION
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:38.740Z
3
+ -- Generated at: 2026-05-06T10:16:59.320Z
4
4
 
5
5
  CREATE SCHEMA "schemaB";
6
6
 
@@ -121,3 +121,13 @@ undefined
121
121
  2026-05-06T08:18:39.956Z
122
122
  undefined
123
123
 
124
+ 2026-05-06T08:31:51.201Z
125
+
126
+ ecommerce.dbml(17,24): Expect an identifier
127
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
128
+
129
+ 2026-05-06T10:17:00.549Z
130
+
131
+ ecommerce.dbml(17,24): Expect an identifier
132
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
133
+
@@ -124,3 +124,11 @@ undefined
124
124
  2026-05-06T08:18:41.350Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:52.703Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
130
+
131
+ 2026-05-06T10:17:02.003Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
134
+
@@ -124,3 +124,11 @@ undefined
124
124
  2026-05-06T08:18:42.669Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:54.324Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
130
+
131
+ 2026-05-06T10:17:03.429Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
134
+
@@ -124,3 +124,11 @@ undefined
124
124
  2026-05-06T08:18:44.046Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:55.691Z
128
+
129
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
130
+
131
+ 2026-05-06T10:17:04.922Z
132
+
133
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
134
+
@@ -124,3 +124,11 @@ undefined
124
124
  2026-05-06T08:18:45.383Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:57.068Z
128
+
129
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
130
+
131
+ 2026-05-06T10:17:06.468Z
132
+
133
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
134
+
@@ -124,3 +124,11 @@ undefined
124
124
  2026-05-06T08:18:46.726Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:58.490Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
130
+
131
+ 2026-05-06T10:17:07.902Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
134
+
@@ -124,3 +124,11 @@ undefined
124
124
  2026-05-06T08:18:48.105Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:59.877Z
128
+
129
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
130
+
131
+ 2026-05-06T10:17:09.292Z
132
+
133
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
134
+
@@ -111,3 +111,11 @@ undefined
111
111
  2026-05-06T08:18:03.492Z
112
112
  undefined
113
113
 
114
+ 2026-05-06T08:32:30.153Z
115
+
116
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
117
+
118
+ 2026-05-06T10:17:39.447Z
119
+
120
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
121
+
@@ -108,3 +108,11 @@ undefined
108
108
  2026-05-06T08:18:04.905Z
109
109
  undefined
110
110
 
111
+ 2026-05-06T08:32:31.718Z
112
+
113
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
114
+
115
+ 2026-05-06T10:17:40.917Z
116
+
117
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
118
+
@@ -108,3 +108,7 @@ undefined
108
108
  2026-05-06T08:18:06.210Z
109
109
  undefined
110
110
 
111
+ 2026-05-06T10:17:42.282Z
112
+
113
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
114
+
package/lib/index.js CHANGED
@@ -29,6 +29,8 @@ let chalk = require("chalk");
29
29
  chalk = __toESM(chalk);
30
30
  let figures = require("figures");
31
31
  figures = __toESM(figures);
32
+ let strip_ansi = require("strip-ansi");
33
+ strip_ansi = __toESM(strip_ansi);
32
34
  let winston = require("winston");
33
35
  let fs = require("fs");
34
36
  fs = __toESM(fs);
@@ -36,7 +38,7 @@ let __dbml_parse = require("@dbml/parse");
36
38
  let node_fs = require("node:fs");
37
39
  const $schema = "https://json.schemastore.org/package";
38
40
  const name = "@dbml/cli";
39
- const version = "8.0.0-alpha.2";
41
+ const version = "8.0.0-alpha.4";
40
42
  const description = "";
41
43
  const main = "lib/index.js";
42
44
  const license = "Apache-2.0";
@@ -63,8 +65,8 @@ const keywords = ["dbml", "dbml-cli"];
63
65
  const dependencies = {
64
66
  "@babel/cli": "^7.21.0",
65
67
  "@dbml/connector": "^8.0.0-alpha.0",
66
- "@dbml/core": "^8.0.0-alpha.0",
67
- "@dbml/parse": "^8.0.0-alpha.0",
68
+ "@dbml/core": "^8.0.0-alpha.4",
69
+ "@dbml/parse": "^8.0.0-alpha.4",
68
70
  "bluebird": "^3.5.5",
69
71
  "chalk": "^2.4.2",
70
72
  "commander": "^2.20.0",
@@ -75,7 +77,7 @@ const dependencies = {
75
77
  "strip-ansi": "^5.2.0",
76
78
  "winston": "^3.2.1"
77
79
  };
78
- const gitHead = "7cc75b05117e6de49330daa327e86f2b32e28978";
80
+ const gitHead = "17d4675433b702912a20dcc65a63c03c73c56db5";
79
81
  const engines = { "node": ">=18" };
80
82
  var package_default = {
81
83
  $schema,
@@ -103,8 +105,8 @@ var consoleFormat = printf((info) => {
103
105
  ${path.default.resolve(process.cwd(), "dbml-error.log")}`;
104
106
  });
105
107
  var fileFormat = printf((info) => {
106
- const { timestamp: ts, stack, rootError } = info;
107
- let logContent = `${ts}\n${stack ?? info}\n`;
108
+ const { timestamp: ts, message, stack, rootError } = info;
109
+ let logContent = `${ts}\n${(0, strip_ansi.default)(stack ?? message ?? "")}\n`;
108
110
  if (rootError) {
109
111
  logContent += "\nROOT_ERROR:";
110
112
  logContent += `\n${rootError.stack}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@dbml/cli",
4
- "version": "8.0.0-alpha.2",
4
+ "version": "8.0.0-alpha.4",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "license": "Apache-2.0",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "@babel/cli": "^7.21.0",
35
35
  "@dbml/connector": "^8.0.0-alpha.0",
36
- "@dbml/core": "^8.0.0-alpha.0",
37
- "@dbml/parse": "^8.0.0-alpha.0",
36
+ "@dbml/core": "^8.0.0-alpha.4",
37
+ "@dbml/parse": "^8.0.0-alpha.4",
38
38
  "bluebird": "^3.5.5",
39
39
  "chalk": "^2.4.2",
40
40
  "commander": "^2.20.0",
@@ -45,7 +45,7 @@
45
45
  "strip-ansi": "^5.2.0",
46
46
  "winston": "^3.2.1"
47
47
  },
48
- "gitHead": "7cc75b05117e6de49330daa327e86f2b32e28978",
48
+ "gitHead": "17d4675433b702912a20dcc65a63c03c73c56db5",
49
49
  "engines": {
50
50
  "node": ">=18"
51
51
  }
@@ -20,9 +20,9 @@ const consoleFormat = printf((info) => {
20
20
 
21
21
  const fileFormat = printf((info) => {
22
22
  const {
23
- timestamp: ts, stack, rootError,
23
+ timestamp: ts, message, stack, rootError,
24
24
  } = info as any;
25
- let logContent = `${ts}\n${stack ?? info}\n`;
25
+ let logContent = `${ts}\n${stripAnsi(stack ?? message ?? '')}\n`;
26
26
  if (rootError) {
27
27
  logContent += '\nROOT_ERROR:';
28
28
  logContent += `\n${rootError.stack}`;