@dbml/cli 5.5.1 → 5.6.0-alpha.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/__tests__/db2dbml/mssql/dbml-error.log +22 -0
- package/__tests__/db2dbml/mysql/dbml-error.log +6 -0
- package/__tests__/db2dbml/oracle/dbml-error.log +28 -0
- package/__tests__/db2dbml/postgres/dbml-error.log +14 -0
- package/__tests__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +65 -0
- package/__tests__/dbml2sql/filename --mysql stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +61 -0
- package/__tests__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +77 -0
- package/__tests__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +77 -0
- package/__tests__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +172 -0
- package/__tests__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +172 -0
- package/__tests__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +172 -0
- package/__tests__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +172 -0
- package/__tests__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +62 -0
- package/__tests__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +50 -0
- package/__tests__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +88 -0
- package/__tests__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +67 -0
- package/__tests__/dbml2sql/syntax-error/dbml-error.log +6 -0
- package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +6 -0
- package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +6 -0
- package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +6 -0
- package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +6 -0
- package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +6 -0
- package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +6 -0
- package/__tests__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +25 -0
- package/__tests__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +74 -0
- package/__tests__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --oracle --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --oracle --out-file/out-files/schema.dbml +83 -0
- package/__tests__/sql2dbml/filename --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --out-file/out-files/schema.dbml +74 -0
- package/__tests__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +74 -0
- package/__tests__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --snowflake stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +170 -0
- package/__tests__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --out-file/out-files/schema.dbml +170 -0
- package/__tests__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +170 -0
- package/__tests__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +58 -0
- package/__tests__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +136 -0
- package/__tests__/sql2dbml/multiple_schema_pg/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +101 -0
- package/__tests__/sql2dbml/syntax-error/dbml-error.log +6 -0
- package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +6 -0
- package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +6 -0
- package/eslint.config.ts +13 -6
- package/lib/index.js +374 -20
- package/package.json +9 -26
- package/tsconfig.json +2 -1
- package/vite.config.ts +50 -0
- package/.babelrc +0 -19
- package/jest.config.ts +0 -14
- package/lib/cli/config.js +0 -29
- package/lib/cli/connector.js +0 -38
- package/lib/cli/export.js +0 -37
- package/lib/cli/import.js +0 -36
- package/lib/cli/index.js +0 -76
- package/lib/cli/outputPlugins/outputConsolePlugin.js +0 -12
- package/lib/cli/outputPlugins/outputFilePlugin.js +0 -28
- package/lib/cli/utils.js +0 -81
- package/lib/cli/validatePlugins/validatePlugins.js +0 -14
- package/lib/errors/domainError.js +0 -15
- package/lib/errors/index.js +0 -20
- package/lib/errors/syntaxError.js +0 -23
- package/lib/helpers/logger.js +0 -74
|
@@ -0,0 +1,136 @@
|
|
|
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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
}
|
package/eslint.config.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { defineConfig } from 'eslint/config';
|
|
|
4
4
|
import stylistic from '@stylistic/eslint-plugin';
|
|
5
5
|
import tseslint from 'typescript-eslint';
|
|
6
6
|
import tsparser from '@typescript-eslint/parser';
|
|
7
|
-
import jest from 'eslint-plugin-jest';
|
|
8
7
|
|
|
9
8
|
export default defineConfig(
|
|
10
9
|
eslint.configs.recommended,
|
|
@@ -21,9 +20,8 @@ export default defineConfig(
|
|
|
21
20
|
'node_modules/*',
|
|
22
21
|
'lib/*',
|
|
23
22
|
'bin/*',
|
|
24
|
-
'jestHelpers.js',
|
|
25
23
|
'eslint.config.ts',
|
|
26
|
-
'
|
|
24
|
+
'vite.config.ts',
|
|
27
25
|
],
|
|
28
26
|
},
|
|
29
27
|
{
|
|
@@ -38,6 +36,7 @@ export default defineConfig(
|
|
|
38
36
|
sourceType: 'module',
|
|
39
37
|
ecmaVersion: 2018,
|
|
40
38
|
project: './tsconfig.json',
|
|
39
|
+
tsconfigRootDir: import.meta.dirname,
|
|
41
40
|
},
|
|
42
41
|
},
|
|
43
42
|
plugins: {
|
|
@@ -74,11 +73,19 @@ export default defineConfig(
|
|
|
74
73
|
},
|
|
75
74
|
},
|
|
76
75
|
{
|
|
77
|
-
files: ['**/*.test.js', '**/*.spec.js'],
|
|
78
|
-
...jest.configs['flat/recommended'],
|
|
76
|
+
files: ['**/*.test.js', '**/*.spec.js', '**/*.test.ts', '**/*.spec.ts'],
|
|
79
77
|
languageOptions: {
|
|
80
78
|
globals: {
|
|
81
|
-
|
|
79
|
+
// Vitest globals
|
|
80
|
+
describe: 'readonly',
|
|
81
|
+
it: 'readonly',
|
|
82
|
+
test: 'readonly',
|
|
83
|
+
expect: 'readonly',
|
|
84
|
+
beforeAll: 'readonly',
|
|
85
|
+
afterAll: 'readonly',
|
|
86
|
+
beforeEach: 'readonly',
|
|
87
|
+
afterEach: 'readonly',
|
|
88
|
+
vi: 'readonly',
|
|
82
89
|
},
|
|
83
90
|
},
|
|
84
91
|
rules: {
|