@dbml/cli 2.4.3 → 2.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.
Files changed (26) hide show
  1. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  2. package/__test__/dbml2sql/filename --out-file/expect-out-files/schema.sql +1 -1
  3. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +2 -2
  4. package/__test__/dbml2sql/filename --postgres --out-file/expect-out-files/schema.sql +1 -1
  5. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +2 -2
  6. package/__test__/dbml2sql/filename --postgres stdout/stdout.txt +1 -1
  7. package/__test__/dbml2sql/filename stdout/stdout.txt +1 -1
  8. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  9. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  10. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  11. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  12. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  13. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  14. package/__test__/dbml2sql/syntax-error/dbml-error.log +450 -2016
  15. package/__test__/sql2dbml/filename --out-file/expect-out-files/schema.dbml +1 -1
  16. package/__test__/sql2dbml/filename --out-file/out-files/schema.dbml +1 -1
  17. package/__test__/sql2dbml/filename --postgres --out-file/expect-out-files/schema.dbml +1 -1
  18. package/__test__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +1 -1
  19. package/__test__/sql2dbml/filename --postgres stdout/stdout.txt +1 -1
  20. package/__test__/sql2dbml/filename stdout/stdout.txt +1 -1
  21. package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +52 -0
  22. package/__test__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +33 -2
  23. package/__test__/sql2dbml/syntax-error/dbml-error.log +450 -1908
  24. package/bin/dbml2sql.js +0 -0
  25. package/bin/sql2dbml.js +0 -0
  26. package/package.json +3 -3
@@ -11,7 +11,7 @@ Enum "product status" {
11
11
  }
12
12
 
13
13
  Table "orders" {
14
- "id" int [pk, increment]
14
+ "id" SERIAL [pk, increment]
15
15
  "user_id" int [unique, not null]
16
16
  "status" orders_status
17
17
  "created_at" varchar
@@ -11,7 +11,7 @@ Enum "product status" {
11
11
  }
12
12
 
13
13
  Table "orders" {
14
- "id" int [pk, increment]
14
+ "id" SERIAL [pk, increment]
15
15
  "user_id" int [unique, not null]
16
16
  "status" orders_status
17
17
  "created_at" varchar
@@ -11,7 +11,7 @@ Enum "product status" {
11
11
  }
12
12
 
13
13
  Table "orders" {
14
- "id" int [pk, increment]
14
+ "id" SERIAL [pk, increment]
15
15
  "user_id" int [unique, not null]
16
16
  "status" orders_status
17
17
  "created_at" varchar
@@ -11,7 +11,7 @@ Enum "product status" {
11
11
  }
12
12
 
13
13
  Table "orders" {
14
- "id" int [pk, increment]
14
+ "id" SERIAL [pk, increment]
15
15
  "user_id" int [unique, not null]
16
16
  "status" orders_status
17
17
  "created_at" varchar
@@ -11,7 +11,7 @@ Enum "product status" {
11
11
  }
12
12
 
13
13
  Table "orders" {
14
- "id" int [pk, increment]
14
+ "id" SERIAL [pk, increment]
15
15
  "user_id" int [unique, not null]
16
16
  "status" orders_status
17
17
  "created_at" varchar
@@ -11,7 +11,7 @@ Enum "product status" {
11
11
  }
12
12
 
13
13
  Table "orders" {
14
- "id" int [pk, increment]
14
+ "id" SERIAL [pk, increment]
15
15
  "user_id" int [unique, not null]
16
16
  "status" orders_status
17
17
  "created_at" varchar
@@ -0,0 +1,52 @@
1
+ 2022-07-13T08:31:21.074Z
2
+ SyntaxError: You have a syntax error at "multiple_schema.in.sql".
3
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/utils.js:42:13
4
+ at Array.forEach (<anonymous>)
5
+ at generate (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/utils.js:36:14)
6
+ at importHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/import.js:28:7)
7
+ at sql2dbml (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/index.js:35:3)
8
+ at Object.<anonymous> (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/__test__/sql2dbml_bin.js:5:1)
9
+ at Module._compile (internal/modules/cjs/loader.js:1158:30)
10
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
11
+ at Module.load (internal/modules/cjs/loader.js:1002:32)
12
+ at Function.Module._load (internal/modules/cjs/loader.js:901:14)
13
+
14
+ ROOT_ERROR:
15
+ TypeError: Cannot read property 'forEach' of null
16
+ at Endpoint.setFields (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/endpoint.js:143:18)
17
+ at new Endpoint (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/endpoint.js:81:11)
18
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/ref.js:99:31
19
+ at Array.forEach (<anonymous>)
20
+ at Ref.processEndpoints (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/ref.js:98:20)
21
+ at new Ref (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/ref.js:83:11)
22
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/database.js:173:28
23
+ at Array.forEach (<anonymous>)
24
+ at Database.processSchemaElements (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/database.js:143:16)
25
+ at new Database (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/node_modules/@dbml/core/lib/model_structure/database.js:99:11)
26
+
27
+ 2022-07-14T05:00:39.132Z
28
+ SyntaxError: You have a syntax error at "multiple_schema.in.sql".
29
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/utils.js:42:13
30
+ at Array.forEach (<anonymous>)
31
+ at generate (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/utils.js:36:14)
32
+ at importHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/import.js:28:7)
33
+ at sql2dbml (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/src/cli/index.js:35:3)
34
+ at Object.<anonymous> (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/__test__/sql2dbml_bin.js:5:1)
35
+ at Module._compile (internal/modules/cjs/loader.js:1158:30)
36
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
37
+ at Module.load (internal/modules/cjs/loader.js:1002:32)
38
+ at Function.Module._load (internal/modules/cjs/loader.js:901:14)
39
+
40
+ ROOT_ERROR:
41
+ TypeError: Cannot read property 'forEach' of null
42
+ at Endpoint.setFields (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/endpoint.js:179:18)
43
+ at new Endpoint (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/endpoint.js:93:11)
44
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/ref.js:99:31
45
+ at Array.forEach (<anonymous>)
46
+ at Ref.processEndpoints (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/ref.js:98:20)
47
+ at new Ref (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/ref.js:83:11)
48
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/database.js:173:28
49
+ at Array.forEach (<anonymous>)
50
+ at Database.processSchemaElements (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/database.js:143:16)
51
+ at new Database (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/model_structure/database.js:99:11)
52
+
@@ -17,9 +17,16 @@ Table "users" {
17
17
  "pjs2" job_status
18
18
  "pg" schemaB.gender
19
19
  "pg2" gender
20
+ "country_code" int
20
21
  Note: 'Sample note on table users'
21
22
  }
22
23
 
24
+ Table "countries" {
25
+ "code" int [pk]
26
+ "name" varchar
27
+ "continent_name" varchar
28
+ }
29
+
23
30
  Table "products" {
24
31
  "id" int [pk]
25
32
  "name" varchar [note: 'Product name of table products in public schema']
@@ -29,16 +36,40 @@ Indexes {
29
36
  }
30
37
  }
31
38
 
32
- Ref:"schemaA"."locations"."id" < "schemaA"."products"."lid"
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"
33
60
 
34
61
  Ref:"users"."id" < "ecommerce"."users"."id"
35
62
 
36
- Ref:"users"."name" < "ecommerce"."users"."id"
63
+ Ref "name_optional":"users"."name" < "ecommerce"."users"."id"
37
64
 
38
65
  Ref:"ecommerce"."users"."id" < "schemaA"."products"."name"
39
66
 
40
67
  Ref:"users"."id" < "schemaA"."locations"."name"
41
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
+
42
73
  Enum "schemaB"."gender" {
43
74
  "male"
44
75
  "female"