@dbml/cli 8.0.0-alpha.1 → 8.0.0-alpha.3

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 (25) hide show
  1. package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  2. package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +1 -1
  3. package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  4. package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  5. package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  6. package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +1 -1
  7. package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  8. package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  9. package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  10. package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  11. package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +1 -1
  12. package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  13. package/__tests__/dbml2sql/syntax-error/dbml-error.log +5 -0
  14. package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +4 -0
  15. package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +4 -0
  16. package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +4 -0
  17. package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +4 -0
  18. package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +4 -0
  19. package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +4 -0
  20. package/__tests__/sql2dbml/syntax-error/dbml-error.log +4 -0
  21. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +4 -0
  22. package/lib/index.js +6 -4
  23. package/package.json +2 -2
  24. package/src/cli/connector.ts +1 -1
  25. package/src/helpers/logger.ts +3 -3
@@ -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-06T08:31:23.581Z
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-06T08:31:26.282Z
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-06T08:31:29.132Z
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-06T08:31:30.402Z
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-06T08:31:34.430Z
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-06T08:31:36.960Z
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-06T08:31:39.551Z
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-06T08:31:40.820Z
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-06T08:31:45.929Z
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-06T08:31:47.173Z
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-06T08:31:48.501Z
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-06T08:31:49.885Z
4
4
 
5
5
  CREATE SCHEMA "schemaB";
6
6
 
@@ -121,3 +121,8 @@ 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
+
@@ -124,3 +124,7 @@ 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
+
@@ -124,3 +124,7 @@ 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
+
@@ -124,3 +124,7 @@ 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
+
@@ -124,3 +124,7 @@ 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
+
@@ -124,3 +124,7 @@ 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
+
@@ -124,3 +124,7 @@ 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
+
@@ -111,3 +111,7 @@ 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
+
@@ -108,3 +108,7 @@ 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
+
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.1";
41
+ const version = "8.0.0-alpha.3";
40
42
  const description = "";
41
43
  const main = "lib/index.js";
42
44
  const license = "Apache-2.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 = "9c741ec1eb685be6f319c263a9a86628b241b2c4";
80
+ const gitHead = "55f87cb7b6c94255df93d5f486b4630b4cff9542";
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}\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.1",
4
+ "version": "8.0.0-alpha.3",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "license": "Apache-2.0",
@@ -45,7 +45,7 @@
45
45
  "strip-ansi": "^5.2.0",
46
46
  "winston": "^3.2.1"
47
47
  },
48
- "gitHead": "9c741ec1eb685be6f319c263a9a86628b241b2c4",
48
+ "gitHead": "55f87cb7b6c94255df93d5f486b4630b4cff9542",
49
49
  "engines": {
50
50
  "node": ">=18"
51
51
  }
@@ -37,6 +37,6 @@ export default async function connectionHandler (program: Command) {
37
37
  console.log(` ${chalk.green(figures.main.tick)} Generated DBML file from database's connection: ${path.basename(opts.outFile)}`);
38
38
  }
39
39
  } catch (error) {
40
- logger.error(error);
40
+ logger.error(error as Error | string);
41
41
  }
42
42
  }
@@ -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}\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}`;
@@ -69,7 +69,7 @@ const logger = {
69
69
  consoleLogger.warn(msg);
70
70
  },
71
71
 
72
- error (msg: any) {
72
+ error (msg: Error | string) {
73
73
  consoleLogger.error(msg);
74
74
  fileLogger.error(msg);
75
75
  },