@dbml/cli 3.7.0 → 3.7.2

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 (77) hide show
  1. package/__test__/db2dbml/mysql/options.json +1 -1
  2. package/lib/cli/connector.js +4 -2
  3. package/package.json +7 -3
  4. package/src/cli/connector.js +4 -2
  5. package/LICENSE +0 -202
  6. package/__test__/db2dbml/mssql/dbml-error.log +0 -467
  7. package/__test__/db2dbml/mysql/dbml-error.log +0 -281
  8. package/__test__/db2dbml/mysql/out-files/schema.dbml +0 -180
  9. package/__test__/db2dbml/postgres/dbml-error.log +0 -252
  10. package/__test__/db2dbml/postgres/out-files/schema.dbml +0 -140
  11. package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -0
  12. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +0 -65
  13. package/__test__/dbml2sql/filename --mysql stdout/dbml-error.log +0 -0
  14. package/__test__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
  15. package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +0 -61
  16. package/__test__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
  17. package/__test__/dbml2sql/filename --out-file/dbml-error.log +0 -0
  18. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +0 -77
  19. package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -0
  20. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +0 -77
  21. package/__test__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
  22. package/__test__/dbml2sql/filename stdout/dbml-error.log +0 -0
  23. package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -0
  24. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +0 -172
  25. package/__test__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
  26. package/__test__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
  27. package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +0 -172
  28. package/__test__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
  29. package/__test__/dbml2sql/filenames --out-file/dbml-error.log +0 -0
  30. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +0 -172
  31. package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -0
  32. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +0 -172
  33. package/__test__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
  34. package/__test__/dbml2sql/filenames stdout/dbml-error.log +0 -0
  35. package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -0
  36. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +0 -62
  37. package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -0
  38. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +0 -50
  39. package/__test__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
  40. package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +0 -88
  41. package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -0
  42. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +0 -67
  43. package/__test__/dbml2sql/syntax-error/dbml-error.log +0 -12
  44. package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -0
  45. package/__test__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +0 -25
  46. package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -0
  47. package/__test__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +0 -74
  48. package/__test__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
  49. package/__test__/sql2dbml/filename --out-file/dbml-error.log +0 -0
  50. package/__test__/sql2dbml/filename --out-file/out-files/schema.dbml +0 -74
  51. package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -0
  52. package/__test__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +0 -74
  53. package/__test__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
  54. package/__test__/sql2dbml/filename --snowflake stdout/dbml-error.log +0 -0
  55. package/__test__/sql2dbml/filename stdout/dbml-error.log +0 -0
  56. package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -0
  57. package/__test__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +0 -170
  58. package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
  59. package/__test__/sql2dbml/filenames --out-file/dbml-error.log +0 -0
  60. package/__test__/sql2dbml/filenames --out-file/out-files/schema.dbml +0 -170
  61. package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -0
  62. package/__test__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +0 -170
  63. package/__test__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
  64. package/__test__/sql2dbml/filenames stdout/dbml-error.log +0 -0
  65. package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -0
  66. package/__test__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +0 -106
  67. package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -0
  68. package/__test__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +0 -136
  69. package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +0 -0
  70. package/__test__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +0 -101
  71. package/__test__/sql2dbml/syntax-error/dbml-error.log +0 -12
  72. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +0 -12
  73. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +0 -12
  74. package/dbml-error.log +0 -53
  75. package/lib/connectors/Connector.js +0 -19
  76. package/lib/connectors/MssqlConnector.js +0 -483
  77. package/lib/connectors/PostgresConnector.js +0 -450
@@ -1,136 +0,0 @@
1
- Enum "users_pjs_enum" {
2
- "created2"
3
- "running2"
4
- "done2"
5
- "failure2"
6
- }
7
-
8
- Enum "users_pjs2_enum" {
9
- "created2"
10
- "running2"
11
- "done2"
12
- "failure2"
13
- }
14
-
15
- Enum "users_pg_enum" {
16
- "male"
17
- "female"
18
- }
19
-
20
- Enum "users_pg2_enum" {
21
- "male2"
22
- "female2"
23
- }
24
-
25
- Table "users" {
26
- "id" int [pk]
27
- "name" varchar(255)
28
- "pjs" users_pjs_enum
29
- "pjs2" users_pjs2_enum
30
- "pg" users_pg_enum
31
- "pg2" users_pg2_enum
32
- }
33
-
34
- Table "products" {
35
- "id" int [pk]
36
- "name" varchar(255) [note: 'Product name']
37
- }
38
-
39
- Table "orders" {
40
- "id1" int
41
- "id2" int
42
- "pid" int
43
- "name" varchar(255)
44
- "name2" varchar(255)
45
-
46
- Indexes {
47
- (id1, id2) [pk, type: hash, name: "CPK_1"]
48
- (name, name2) [type: btree, unique, name: "I_UNIQUE_1"]
49
- (id1, id2) [type: hash, name: "INDEX_2"]
50
- }
51
- Note: 'this is table orders'
52
- }
53
-
54
- Table "orders2" {
55
- "id1" int
56
- "id2" int
57
- "pid" int
58
-
59
- Indexes {
60
- (id1, id2) [pk, name: "testCPK"]
61
- }
62
- }
63
-
64
- Table "orders4" {
65
- "id1" int
66
- "id2" int
67
-
68
- Indexes {
69
- (id1, id2) [pk, name: "PK_orders4_id1_id2"]
70
- }
71
- }
72
-
73
- Ref "FK_1":"schemaA"."locations"."id" < "schemaA"."products"."lid" [delete: cascade]
74
-
75
- Ref:"schemaA"."products"."id" < "orders"."pid"
76
-
77
- Ref:"schemaA"."products"."id" < "orders2"."pid"
78
-
79
- Ref "CFK_1":"orders".("id1", "id2") < "orders2".("id1", "id2") [update: set null, delete: cascade]
80
-
81
- Ref:"users"."id" < "ecommerce"."users"."id"
82
-
83
- Ref "name_optional":"users"."name" < "ecommerce"."users"."id"
84
-
85
- Ref:"ecommerce"."users"."id" < "schemaA"."products"."name"
86
-
87
- Ref:"users"."id" < "schemaA"."locations"."name"
88
-
89
- Enum "ecommerce"."users_ejs_enum" {
90
- "created2"
91
- "running2"
92
- "done2"
93
- "failure2"
94
- }
95
-
96
- Enum "ecommerce"."users_ejs2_enum" {
97
- "created2"
98
- "running2"
99
- "done2"
100
- "failure2"
101
- }
102
-
103
- Enum "ecommerce"."users_eg_enum" {
104
- "male"
105
- "female"
106
- }
107
-
108
- Enum "ecommerce"."users_eg2_enum" {
109
- "male2"
110
- "female2"
111
- }
112
-
113
- Table "ecommerce"."users" {
114
- "id" int [pk]
115
- "name" varchar(255)
116
- "ejs" ecommerce.users_ejs_enum
117
- "ejs2" ecommerce.users_ejs2_enum
118
- "eg" ecommerce.users_eg_enum
119
- "eg2" ecommerce.users_eg2_enum
120
- }
121
-
122
- Table "schemaA"."products" {
123
- "id" int [pk]
124
- "name" varchar(255) [note: 'Sample field comment on multiples schema']
125
- "lid" int
126
- }
127
-
128
- Table "schemaA"."locations" {
129
- "id" int [pk]
130
- "name" varchar(255)
131
- }
132
-
133
- Table "schemaB"."orders3" {
134
- "id1" int [pk]
135
- "id2" int
136
- }
@@ -1,101 +0,0 @@
1
- Enum "job_status" {
2
- "created2"
3
- "running2"
4
- "done2"
5
- "failure2"
6
- }
7
-
8
- Enum "gender" {
9
- "male2"
10
- "female2"
11
- }
12
-
13
- Table "users" {
14
- "id" int [pk]
15
- "name" varchar
16
- "pjs" job_status
17
- "pjs2" job_status
18
- "pg" schemaB.gender
19
- "pg2" gender
20
- "country_code" int
21
- Note: 'Sample note on table users'
22
- }
23
-
24
- Table "countries" {
25
- "code" int [pk]
26
- "name" varchar
27
- "continent_name" varchar
28
- }
29
-
30
- Table "products" {
31
- "id" int [pk]
32
- "name" varchar [note: 'Product name of table products in public schema']
33
-
34
- Indexes {
35
- id [type: hash, unique]
36
- }
37
- }
38
-
39
- Table "booking_reference" {
40
- "reference_id" NVARCHAR(10) [not null]
41
- "cust_id" NUMBER(10) [not null]
42
- "status" NVARCHAR(1) [not null]
43
-
44
- Indexes {
45
- (reference_id, cust_id) [pk]
46
- }
47
- }
48
-
49
- Table "br_flight" {
50
- "reference_id" NVARCHAR(10) [not null]
51
- "cust_id" NUMBER(10) [not null]
52
- "flight_id" NVARCHAR(10) [not null]
53
-
54
- Indexes {
55
- (reference_id, flight_id) [pk]
56
- }
57
- }
58
-
59
- Ref "fk_1":"schemaA"."locations"."id" < "schemaA"."products"."lid"
60
-
61
- Ref:"users"."id" < "ecommerce"."users"."id"
62
-
63
- Ref "name_optional":"users"."name" < "ecommerce"."users"."id"
64
-
65
- Ref:"ecommerce"."users"."id" < "schemaA"."products"."name"
66
-
67
- Ref:"users"."id" < "schemaA"."locations"."name"
68
-
69
- Ref "fk_composite":"booking_reference".("reference_id", "cust_id") < "br_flight".("reference_id", "cust_id")
70
-
71
- Ref "fk_country_code":"countries"."code" < "users"."country_code"
72
-
73
- Enum "schemaB"."gender" {
74
- "male"
75
- "female"
76
- }
77
-
78
- Table "ecommerce"."users" {
79
- "id" int [pk]
80
- "name" varchar
81
- "ejs" job_status
82
- "ejs2" job_status
83
- "eg" schemaB.gender
84
- "eg2" gender
85
- }
86
-
87
- Table "schemaA"."products" {
88
- "id" int [pk]
89
- "name" varchar [note: 'Product name of schemaA']
90
- "lid" int
91
-
92
- Indexes {
93
- (id, name) [name: "product_status"]
94
- }
95
- }
96
-
97
- Table "schemaA"."locations" {
98
- "id" int [pk]
99
- "name" varchar
100
- Note: 'This is a note in table "locations"'
101
- }
@@ -1,12 +0,0 @@
1
- 2024-06-12T04:32:03.429Z
2
- undefined
3
-
4
- 2024-08-09T00:05:09.112Z
5
- undefined
6
-
7
- 2024-08-09T03:08:08.840Z
8
- undefined
9
-
10
- 2024-08-11T02:28:22.795Z
11
- undefined
12
-
@@ -1,12 +0,0 @@
1
- 2024-06-12T04:32:03.669Z
2
- undefined
3
-
4
- 2024-08-09T00:05:09.476Z
5
- undefined
6
-
7
- 2024-08-09T03:08:09.208Z
8
- undefined
9
-
10
- 2024-08-11T02:28:23.316Z
11
- undefined
12
-
@@ -1,12 +0,0 @@
1
- 2024-06-12T04:32:04.090Z
2
- undefined
3
-
4
- 2024-08-09T00:05:09.972Z
5
- undefined
6
-
7
- 2024-08-09T03:08:09.727Z
8
- undefined
9
-
10
- 2024-08-11T02:28:24.073Z
11
- undefined
12
-
package/dbml-error.log DELETED
@@ -1,53 +0,0 @@
1
- 2024-08-07T02:44:57.506Z
2
- Error: Error: connect ECONNREFUSED 127.0.0.1:3306
3
- at _callee8$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:474:17)
4
- at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:1357)
5
- at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:4174)
6
- at Generator.throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:2208)
7
- at asyncGeneratorStep (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:17:103)
8
- at _throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:18:291)
9
- at processTicksAndRejections (node:internal/process/task_queues:96:5)
10
-
11
- 2024-08-07T02:51:24.263Z
12
- Error: Error: MySQL connection error:
13
- at _callee8$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:485:17)
14
- at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:1357)
15
- at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:4174)
16
- at Generator.throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:2208)
17
- at asyncGeneratorStep (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:17:103)
18
- at _throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:18:291)
19
- at processTicksAndRejections (node:internal/process/task_queues:96:5)
20
-
21
- 2024-08-07T02:52:34.901Z
22
- Error: Error: MySQL connection error: Error: connect ECONNREFUSED 127.0.0.1:3306
23
- at _callee8$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:485:17)
24
- at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:1357)
25
- at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:4174)
26
- at Generator.throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:2208)
27
- at asyncGeneratorStep (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:17:103)
28
- at _throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:18:291)
29
- at processTicksAndRejections (node:internal/process/task_queues:96:5)
30
-
31
- 2024-08-07T02:53:35.536Z
32
- Error: Error: MySQL connection error: Error: connect ECONNREFUSED 127.0.0.1:3306
33
- at _callee8$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:485:17)
34
- at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:1357)
35
- at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:4174)
36
- at Generator.throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:16:2208)
37
- at asyncGeneratorStep (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:17:103)
38
- at _throw (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/connection/mysql/utils/sql.js:18:291)
39
- at processTicksAndRejections (node:internal/process/task_queues:96:5)
40
-
41
- 2024-08-12T04:39:12.767Z
42
- TypeError [ERR_INVALID_URL]: Invalid URL
43
- at new NodeError (node:internal/errors:387:5)
44
- at URL.onParseError (node:internal/url:565:9)
45
- at new URL (node:internal/url:641:5)
46
- at Function.parseUrl (/Users/huylm/code/dbx/dbml/node_modules/mysql2/lib/connection_config.js:263:23)
47
- at new ConnectionConfig (/Users/huylm/code/dbx/dbml/node_modules/mysql2/lib/connection_config.js:75:34)
48
- at Object.exports.createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/index.js:10:35)
49
- at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:252:31)
50
- at _callee$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/connectors/mysqlConnector.js:41:48)
51
- at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/connectors/mysqlConnector.js:14:1357)
52
- at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/connectors/mysqlConnector.js:14:4174)
53
-
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fetchSchemaJson = void 0;
7
- var _PostgresConnector = require("./PostgresConnector");
8
- var _MssqlConnector = require("./MssqlConnector");
9
- const fetchSchemaJson = async (connection, format) => {
10
- switch (format) {
11
- case 'postgres':
12
- return (0, _PostgresConnector.fetchSchemaJson)(connection);
13
- case 'mssql':
14
- return (0, _MssqlConnector.fetchSchemaJson)(connection);
15
- default:
16
- throw new Error(`Unsupported connection format: ${format}`);
17
- }
18
- };
19
- exports.fetchSchemaJson = fetchSchemaJson;