@dbml/cli 3.4.2 → 3.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 (54) hide show
  1. package/__test__/dbml2sql/filename --mysql --out-file/in-files/schema.dbml +4 -4
  2. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +2 -2
  3. package/__test__/dbml2sql/filename --mysql stdout/in-files/schema.dbml +4 -4
  4. package/__test__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
  5. package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +61 -0
  6. package/__test__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
  7. package/__test__/dbml2sql/filename --out-file/in-files/schema.dbml +4 -4
  8. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +2 -2
  9. package/__test__/dbml2sql/filename --postgres --out-file/in-files/schema.dbml +4 -4
  10. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +2 -2
  11. package/__test__/dbml2sql/filename --postgres stdout/in-files/schema.dbml +4 -4
  12. package/__test__/dbml2sql/filename stdout/in-files/schema.dbml +4 -4
  13. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +2 -2
  14. package/__test__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
  15. package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +172 -0
  16. package/__test__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
  17. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +2 -2
  18. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +2 -2
  19. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +2 -2
  20. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +2 -2
  21. package/__test__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
  22. package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +88 -0
  23. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +2 -2
  24. package/__test__/dbml2sql/syntax-error/dbml-error.log +3 -0
  25. package/__test__/sql2dbml/filename --mssql --out-file/expect-out-files/schema.dbml +3 -3
  26. package/__test__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +3 -3
  27. package/__test__/sql2dbml/filename --mysql --out-file/expect-out-files/schema.dbml +4 -4
  28. package/__test__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +4 -4
  29. package/__test__/sql2dbml/filename --mysql stdout/stdout.txt +4 -4
  30. package/__test__/sql2dbml/filename --out-file/expect-out-files/schema.dbml +4 -4
  31. package/__test__/sql2dbml/filename --out-file/out-files/schema.dbml +4 -4
  32. package/__test__/sql2dbml/filename --postgres --out-file/expect-out-files/schema.dbml +4 -4
  33. package/__test__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +4 -4
  34. package/__test__/sql2dbml/filename --postgres stdout/stdout.txt +8 -8
  35. package/__test__/sql2dbml/filename stdout/stdout.txt +4 -4
  36. package/__test__/sql2dbml/filenames --mysql --out-file/expect-out-files/schema.dbml +3 -3
  37. package/__test__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +3 -3
  38. package/__test__/sql2dbml/filenames --mysql stdout/stdout.txt +3 -3
  39. package/__test__/sql2dbml/filenames --out-file/expect-out-files/schema.dbml +3 -3
  40. package/__test__/sql2dbml/filenames --out-file/out-files/schema.dbml +3 -3
  41. package/__test__/sql2dbml/filenames --postgres --out-file/expect-out-files/schema.dbml +3 -3
  42. package/__test__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +3 -3
  43. package/__test__/sql2dbml/filenames --postgres stdout/stdout.txt +3 -3
  44. package/__test__/sql2dbml/filenames stdout/stdout.txt +3 -3
  45. package/__test__/sql2dbml/multiple_schema_mssql/expect-out-files/multiple_schema.out.dbml +6 -6
  46. package/__test__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +6 -6
  47. package/__test__/sql2dbml/multiple_schema_mysql/expect-out-files/multiple_schema.out.dbml +11 -11
  48. package/__test__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +11 -11
  49. package/__test__/sql2dbml/multiple_schema_pg/expect-out-files/multiple_schema.out.dbml +12 -12
  50. package/__test__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +12 -12
  51. package/__test__/sql2dbml/syntax-error/dbml-error.log +3 -0
  52. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +3 -0
  53. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +3 -0
  54. package/package.json +3 -3
@@ -32,10 +32,10 @@ Table "products" {
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
34
 
35
- Indexes {
36
- (merchant_id, status) [name: "product_status"]
37
- id [type: hash, unique, name: "products_index_1"]
38
- }
35
+ Indexes {
36
+ (merchant_id, status) [name: "product_status"]
37
+ id [type: hash, unique, name: "products_index_1"]
38
+ }
39
39
  }
40
40
 
41
41
  Table "users" {
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2024-03-19T03:39:26.465Z
3
+ -- Generated at: 2024-04-26T07:09:57.025Z
4
4
 
5
5
  CREATE TABLE `orders` (
6
6
  `id` int PRIMARY KEY AUTO_INCREMENT,
@@ -32,10 +32,10 @@ Table "products" {
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
34
 
35
- Indexes {
36
- (merchant_id, status) [name: "product_status"]
37
- id [type: hash, unique, name: "products_index_1"]
38
- }
35
+ Indexes {
36
+ (merchant_id, status) [name: "product_status"]
37
+ id [type: hash, unique, name: "products_index_1"]
38
+ }
39
39
  }
40
40
 
41
41
  Table "users" {
@@ -0,0 +1,61 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: Oracle
3
+ -- Generated at: 2024-04-26T07:09:57.791Z
4
+
5
+ CREATE TABLE "orders" (
6
+ "id" int GENERATED AS IDENTITY PRIMARY KEY,
7
+ "user_id" int UNIQUE NOT NULL,
8
+ "status" nvarchar2(255) NOT NULL CHECK ("status" IN ('created', 'running', 'done', 'failure'))
9
+ );
10
+
11
+ CREATE TABLE "order_items" (
12
+ "order_id" int,
13
+ "product_id" int,
14
+ "quantity" int DEFAULT 1
15
+ );
16
+
17
+ CREATE TABLE "products" (
18
+ "id" int PRIMARY KEY,
19
+ "name" nvarchar2(255),
20
+ "merchant_id" int NOT NULL,
21
+ "price" int,
22
+ "status" nvarchar2(255) NOT NULL CHECK ("status" IN ('Out of Stock', 'In Stock')),
23
+ "created_at" timestamp DEFAULT current_timestamp
24
+ );
25
+
26
+ CREATE TABLE "users" (
27
+ "id" int PRIMARY KEY,
28
+ "full_name" nvarchar2(255),
29
+ "email" nvarchar2(255) UNIQUE,
30
+ "gender" nvarchar2(255),
31
+ "date_of_birth" date,
32
+ "created_at" timestamp,
33
+ "country_code" int
34
+ );
35
+
36
+ CREATE TABLE "merchants" (
37
+ "id" int PRIMARY KEY,
38
+ "merchant_name" nvarchar2(255),
39
+ "country_code" int,
40
+ "created_at" timestamp,
41
+ "admin_id" int
42
+ );
43
+
44
+ CREATE TABLE "countries" (
45
+ "code" int PRIMARY KEY,
46
+ "name" nvarchar2(255)
47
+ );
48
+
49
+ CREATE INDEX "product_status" ON "products" ("merchant_id", "status");
50
+
51
+ ALTER TABLE "order_items" ADD FOREIGN KEY ("order_id") REFERENCES "orders" ("id");
52
+
53
+ ALTER TABLE "order_items" ADD FOREIGN KEY ("product_id") REFERENCES "products" ("id");
54
+
55
+ ALTER TABLE "users" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
56
+
57
+ ALTER TABLE "merchants" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
58
+
59
+ ALTER TABLE "products" ADD FOREIGN KEY ("merchant_id") REFERENCES "merchants" ("id");
60
+
61
+ ALTER TABLE "merchants" ADD FOREIGN KEY ("admin_id") REFERENCES "users" ("id");
@@ -32,10 +32,10 @@ Table "products" {
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
34
 
35
- Indexes {
36
- (merchant_id, status) [name: "product_status"]
37
- id [type: hash, unique]
38
- }
35
+ Indexes {
36
+ (merchant_id, status) [name: "product_status"]
37
+ id [type: hash, unique]
38
+ }
39
39
  }
40
40
 
41
41
  Table "users" {
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2024-03-19T03:39:27.109Z
3
+ -- Generated at: 2024-04-26T07:09:58.493Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -32,10 +32,10 @@ Table "products" {
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
34
 
35
- Indexes {
36
- (merchant_id, status) [name: "product_status"]
37
- id [type: hash, unique]
38
- }
35
+ Indexes {
36
+ (merchant_id, status) [name: "product_status"]
37
+ id [type: hash, unique]
38
+ }
39
39
  }
40
40
 
41
41
  Table "users" {
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2024-03-19T03:39:27.438Z
3
+ -- Generated at: 2024-04-26T07:09:58.833Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -32,10 +32,10 @@ Table "products" {
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
34
 
35
- Indexes {
36
- (merchant_id, status) [name: "product_status"]
37
- id [type: hash, unique]
38
- }
35
+ Indexes {
36
+ (merchant_id, status) [name: "product_status"]
37
+ id [type: hash, unique]
38
+ }
39
39
  }
40
40
 
41
41
  Table "users" {
@@ -32,10 +32,10 @@ Table "products" {
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
34
 
35
- Indexes {
36
- (merchant_id, status) [name: "product_status"]
37
- id [type: hash, unique]
38
- }
35
+ Indexes {
36
+ (merchant_id, status) [name: "product_status"]
37
+ id [type: hash, unique]
38
+ }
39
39
  }
40
40
 
41
41
  Table "users" {
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2024-03-19T03:39:28.423Z
3
+ -- Generated at: 2024-04-26T07:09:59.892Z
4
4
 
5
5
  CREATE TABLE `staff` (
6
6
  `id` int PRIMARY KEY,
@@ -0,0 +1,172 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: Oracle
3
+ -- Generated at: 2024-04-26T07:10:00.641Z
4
+
5
+ CREATE TABLE "staff" (
6
+ "id" int PRIMARY KEY,
7
+ "first_name" nvarchar2(255),
8
+ "last_name" nvarchar2(255),
9
+ "address_id" int,
10
+ "picture" blob,
11
+ "email" nvarchar2(255),
12
+ "store_id" int,
13
+ "active" number(1),
14
+ "user_name" nvarchar2(255),
15
+ "password" nvarchar2(255),
16
+ "last_update" timestamp
17
+ );
18
+
19
+ CREATE TABLE "store" (
20
+ "id" int PRIMARY KEY,
21
+ "manager_staff_id" int,
22
+ "address_id" int,
23
+ "last_update" timestamp
24
+ );
25
+
26
+ CREATE TABLE "payment" (
27
+ "id" int PRIMARY KEY,
28
+ "customer_id" int,
29
+ "staff_id" int,
30
+ "rental_id" int,
31
+ "amount" float,
32
+ "payment_date" date,
33
+ "last_update" timestamp
34
+ );
35
+
36
+ CREATE TABLE "rental" (
37
+ "id" int PRIMARY KEY,
38
+ "rental_date" date,
39
+ "inventory_id" int,
40
+ "customer_id" int,
41
+ "return_date" date,
42
+ "staff_id" int,
43
+ "last_update" timestamp
44
+ );
45
+
46
+ ALTER TABLE "staff" ADD FOREIGN KEY ("store_id") REFERENCES "store" ("id");
47
+
48
+ ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id");
49
+
50
+ ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id");
51
+
52
+ ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id");
53
+
54
+ ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id");
55
+ CREATE TABLE "country" (
56
+ "id" int PRIMARY KEY,
57
+ "country" nvarchar2(255),
58
+ "last_update" timestamp
59
+ );
60
+
61
+ CREATE TABLE "city" (
62
+ "id" int PRIMARY KEY,
63
+ "city" nvarchar2(255),
64
+ "country_id" int,
65
+ "last_update" timestamp
66
+ );
67
+
68
+ CREATE TABLE "address" (
69
+ "id" int PRIMARY KEY,
70
+ "address" nvarchar2(255),
71
+ "address2" nvarchar2(255),
72
+ "district" nvarchar2(255),
73
+ "city_id" int,
74
+ "postal_code" nvarchar2(255),
75
+ "phone" nvarchar2(255),
76
+ "last_update" timestamp
77
+ );
78
+
79
+ CREATE TABLE "customer" (
80
+ "id" int PRIMARY KEY,
81
+ "store_id" int,
82
+ "first_name" nvarchar2(255),
83
+ "last_name" nvarchar2(255),
84
+ "email" nvarchar2(255),
85
+ "address_id" int,
86
+ "active" number(1),
87
+ "create_Date" timestamp,
88
+ "last_update" timestamp
89
+ );
90
+
91
+ CREATE INDEX "IDX_CUSTOMER" ON "customer" ("id", "first_name");
92
+
93
+ ALTER TABLE "city" ADD FOREIGN KEY ("country_id") REFERENCES "country" ("id");
94
+
95
+ ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id");
96
+
97
+ ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id");
98
+ CREATE TABLE "category" (
99
+ "id" int PRIMARY KEY,
100
+ "name" nvarchar2(255),
101
+ "last_update" timestamp
102
+ );
103
+
104
+ CREATE TABLE "film_category" (
105
+ "id" int PRIMARY KEY,
106
+ "category_id" int,
107
+ "last_update" timestamp
108
+ );
109
+
110
+ CREATE TABLE "language" (
111
+ "id" int PRIMARY KEY,
112
+ "name" nvarchar2(255),
113
+ "last_update" timestamp
114
+ );
115
+
116
+ CREATE TABLE "film_text" (
117
+ "id" int PRIMARY KEY,
118
+ "film_id" int,
119
+ "title" nvarchar2(255),
120
+ "description" nclob
121
+ );
122
+
123
+ CREATE TABLE "actor" (
124
+ "id" int PRIMARY KEY,
125
+ "first_name" nvarchar2(255),
126
+ "last_name" nvarchar2(255),
127
+ "last_update" timestamp
128
+ );
129
+
130
+ CREATE TABLE "film" (
131
+ "id" int PRIMARY KEY,
132
+ "title" nvarchar2(255),
133
+ "description" nclob,
134
+ "releaase_year" int,
135
+ "language_id" int,
136
+ "original_language_id" int,
137
+ "rental_duration" int,
138
+ "rental_rate" float,
139
+ "length" int,
140
+ "replacement_cost" float,
141
+ "rating" nvarchar2(255),
142
+ "special_feature" nvarchar2(255),
143
+ "last_update" timestamp
144
+ );
145
+
146
+ CREATE TABLE "film_actor" (
147
+ "id" int PRIMARY KEY,
148
+ "film_id" int,
149
+ "actor_id" int,
150
+ "last_update" timestamp
151
+ );
152
+
153
+ CREATE TABLE "inventory" (
154
+ "id" int PRIMARY KEY,
155
+ "film_id" int,
156
+ "store_id" int,
157
+ "last_update" timestamp
158
+ );
159
+
160
+ ALTER TABLE "film_category" ADD FOREIGN KEY ("category_id") REFERENCES "category" ("id");
161
+
162
+ ALTER TABLE "film_text" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
163
+
164
+ ALTER TABLE "film" ADD FOREIGN KEY ("language_id") REFERENCES "language" ("id");
165
+
166
+ ALTER TABLE "film" ADD FOREIGN KEY ("original_language_id") REFERENCES "language" ("id");
167
+
168
+ ALTER TABLE "film_actor" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
169
+
170
+ ALTER TABLE "film_actor" ADD FOREIGN KEY ("actor_id") REFERENCES "actor" ("id");
171
+
172
+ ALTER TABLE "inventory" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2024-03-19T03:39:29.091Z
3
+ -- Generated at: 2024-04-26T07:10:01.485Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2024-03-19T03:39:29.425Z
3
+ -- Generated at: 2024-04-26T07:10:01.966Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: SQL Server
3
- -- Generated at: 2024-03-19T03:39:30.421Z
3
+ -- Generated at: 2024-04-26T07:10:03.101Z
4
4
 
5
5
  CREATE SCHEMA [schemaB]
6
6
  GO
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2024-03-19T03:39:30.749Z
3
+ -- Generated at: 2024-04-26T07:10:03.478Z
4
4
 
5
5
  CREATE SCHEMA `schemaB`;
6
6
 
@@ -0,0 +1,88 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: Oracle
3
+ -- Generated at: 2024-04-26T07:10:03.826Z
4
+
5
+ CREATE USER "C##test01"
6
+ NO AUTHENTICATION
7
+ DEFAULT TABLESPACE system
8
+ TEMPORARY TABLESPACE temp
9
+ QUOTA UNLIMITED ON system;
10
+
11
+ CREATE USER "C##test02"
12
+ NO AUTHENTICATION
13
+ DEFAULT TABLESPACE system
14
+ TEMPORARY TABLESPACE temp
15
+ QUOTA UNLIMITED ON system;
16
+
17
+ CREATE TABLE "users" (
18
+ "id" int PRIMARY KEY
19
+ );
20
+
21
+ CREATE TABLE "products" (
22
+ "id" int PRIMARY KEY,
23
+ "user_id" int NOT NULL
24
+ );
25
+
26
+ CREATE TABLE "C##test02"."users_products" (
27
+ "users_id" int,
28
+ "products_id" int,
29
+ PRIMARY KEY ("users_id", "products_id")
30
+ );
31
+
32
+ CREATE TABLE "users_products" (
33
+ "users_id" int,
34
+ "products_id" int,
35
+ PRIMARY KEY ("users_id", "products_id")
36
+ );
37
+
38
+ CREATE TABLE "C##test01"."users_products" (
39
+ "users_id" int,
40
+ "products_id" int,
41
+ PRIMARY KEY ("users_id", "products_id")
42
+ );
43
+
44
+ CREATE TABLE "C##test01"."users" (
45
+ "id" int PRIMARY KEY
46
+ );
47
+
48
+ CREATE TABLE "C##test01"."products" (
49
+ "id" int PRIMARY KEY,
50
+ "user_id" int NOT NULL
51
+ );
52
+
53
+ CREATE TABLE "C##test02"."users" (
54
+ "id" int PRIMARY KEY
55
+ );
56
+
57
+ CREATE TABLE "C##test02"."products" (
58
+ "id" int PRIMARY KEY,
59
+ "user_id" int NOT NULL
60
+ );
61
+
62
+ GRANT REFERENCES ON "C##test01"."users" TO PUBLIC;
63
+
64
+ GRANT REFERENCES ON "users" TO PUBLIC;
65
+
66
+ GRANT REFERENCES ON "C##test02"."users" TO PUBLIC;
67
+
68
+ GRANT REFERENCES ON "products" TO PUBLIC;
69
+
70
+ GRANT REFERENCES ON "C##test02"."products" TO PUBLIC;
71
+
72
+ ALTER TABLE "products" ADD FOREIGN KEY ("user_id") REFERENCES "C##test01"."users" ("id");
73
+
74
+ ALTER TABLE "C##test01"."products" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id");
75
+
76
+ ALTER TABLE "C##test01"."products" ADD FOREIGN KEY ("user_id") REFERENCES "C##test01"."users" ("id");
77
+
78
+ ALTER TABLE "C##test02"."users_products" ADD FOREIGN KEY ("users_id") REFERENCES "C##test02"."users" ("id");
79
+
80
+ ALTER TABLE "C##test02"."users_products" ADD FOREIGN KEY ("products_id") REFERENCES "products" ("id");
81
+
82
+ ALTER TABLE "users_products" ADD FOREIGN KEY ("users_id") REFERENCES "users" ("id");
83
+
84
+ ALTER TABLE "users_products" ADD FOREIGN KEY ("products_id") REFERENCES "C##test02"."products" ("id");
85
+
86
+ ALTER TABLE "C##test01"."users_products" ADD FOREIGN KEY ("users_id") REFERENCES "C##test01"."users" ("id");
87
+
88
+ ALTER TABLE "C##test01"."users_products" ADD FOREIGN KEY ("products_id") REFERENCES "C##test02"."products" ("id");
@@ -1,6 +1,6 @@
1
- -- SQL dump generated using DBML (dbml-lang.org)
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2024-03-19T03:39:31.085Z
3
+ -- Generated at: 2024-04-26T07:10:04.171Z
4
4
 
5
5
  CREATE SCHEMA "schemaB";
6
6
 
@@ -1522,3 +1522,6 @@ undefined
1522
1522
  2024-03-19T03:39:31.421Z
1523
1523
  undefined
1524
1524
 
1525
+ 2024-04-26T07:10:04.577Z
1526
+ undefined
1527
+
@@ -15,9 +15,9 @@ Table "CodeDef" {
15
15
  "EffectiveFromDtTm" DATETIMEOFFSET(7) [not null]
16
16
  "EffectiveThruDtTm" DATETIMEOFFSET(7)
17
17
 
18
- Indexes {
19
- CdKey [pk]
20
- }
18
+ Indexes {
19
+ CdKey [pk]
20
+ }
21
21
  }
22
22
 
23
23
  Ref "fk__CodeDef__ParentCdKey__CodeDef__CdKey":"CodeDef"."CdKey" < "CodeDef"."ParentCdKey"
@@ -15,9 +15,9 @@ Table "CodeDef" {
15
15
  "EffectiveFromDtTm" DATETIMEOFFSET(7) [not null]
16
16
  "EffectiveThruDtTm" DATETIMEOFFSET(7)
17
17
 
18
- Indexes {
19
- CdKey [pk]
20
- }
18
+ Indexes {
19
+ CdKey [pk]
20
+ }
21
21
  }
22
22
 
23
23
  Ref "fk__CodeDef__ParentCdKey__CodeDef__CdKey":"CodeDef"."CdKey" < "CodeDef"."ParentCdKey"
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" products_status_enum
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique, name: "products_index_1"]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique, name: "products_index_1"]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" products_status_enum
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique, name: "products_index_1"]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique, name: "products_index_1"]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" products_status_enum
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique, name: "products_index_1"]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique, name: "products_index_1"]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" "product status"
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" "product status"
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" "product status"
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" "product status"
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" "product status"
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -67,10 +67,10 @@ Table "comment_on_product" {
67
67
  "delete" boolean
68
68
  "comment_value" varchar
69
69
 
70
- Indexes {
71
- (comment_id, product_family) [pk, name: "comment_on_product_pk"]
72
- (delete, comment_id, product_family) [unique, name: "comment_on_product_idx_unique"]
73
- }
70
+ Indexes {
71
+ (comment_id, product_family) [pk, name: "comment_on_product_pk"]
72
+ (delete, comment_id, product_family) [unique, name: "comment_on_product_idx_unique"]
73
+ }
74
74
  }
75
75
 
76
76
  Ref:"orders"."id" < "order_items"."order_id"
@@ -31,10 +31,10 @@ Table "products" {
31
31
  "status" "product status"
32
32
  "created_at" datetime [default: `now()`]
33
33
 
34
- Indexes {
35
- (merchant_id, status) [name: "product_status"]
36
- id [type: hash, unique]
37
- }
34
+ Indexes {
35
+ (merchant_id, status) [name: "product_status"]
36
+ id [type: hash, unique]
37
+ }
38
38
  }
39
39
 
40
40
  Table "users" {
@@ -83,9 +83,9 @@ Table "customer" {
83
83
  "create_Date" timestamp
84
84
  "last_update" timestamp
85
85
 
86
- Indexes {
87
- (id, first_name) [type: btree, name: "customer_index_0"]
88
- }
86
+ Indexes {
87
+ (id, first_name) [type: btree, name: "customer_index_0"]
88
+ }
89
89
  }
90
90
 
91
91
  Ref:"country"."id" < "city"."country_id"
@@ -83,9 +83,9 @@ Table "customer" {
83
83
  "create_Date" timestamp
84
84
  "last_update" timestamp
85
85
 
86
- Indexes {
87
- (id, first_name) [type: btree, name: "customer_index_0"]
88
- }
86
+ Indexes {
87
+ (id, first_name) [type: btree, name: "customer_index_0"]
88
+ }
89
89
  }
90
90
 
91
91
  Ref:"country"."id" < "city"."country_id"
@@ -84,9 +84,9 @@ Table "customer" {
84
84
  "create_Date" timestamp
85
85
  "last_update" timestamp
86
86
 
87
- Indexes {
88
- (id, first_name) [type: btree, name: "customer_index_0"]
89
- }
87
+ Indexes {
88
+ (id, first_name) [type: btree, name: "customer_index_0"]
89
+ }
90
90
  }
91
91
 
92
92
  Ref:"country"."id" < "city"."country_id"
@@ -83,9 +83,9 @@ Table "customer" {
83
83
  "create_Date" timestamp
84
84
  "last_update" timestamp
85
85
 
86
- Indexes {
87
- (id, first_name) [type: btree]
88
- }
86
+ Indexes {
87
+ (id, first_name) [type: btree]
88
+ }
89
89
  }
90
90
 
91
91
  Ref:"country"."id" < "city"."country_id"
@@ -83,9 +83,9 @@ Table "customer" {
83
83
  "create_Date" timestamp
84
84
  "last_update" timestamp
85
85
 
86
- Indexes {
87
- (id, first_name) [type: btree]
88
- }
86
+ Indexes {
87
+ (id, first_name) [type: btree]
88
+ }
89
89
  }
90
90
 
91
91
  Ref:"country"."id" < "city"."country_id"
@@ -83,9 +83,9 @@ Table "customer" {
83
83
  "create_Date" timestamp
84
84
  "last_update" timestamp
85
85
 
86
- Indexes {
87
- (id, first_name) [type: btree]
88
- }
86
+ Indexes {
87
+ (id, first_name) [type: btree]
88
+ }
89
89
  }
90
90
 
91
91
  Ref:"country"."id" < "city"."country_id"
@@ -83,9 +83,9 @@ Table "customer" {
83
83
  "create_Date" timestamp
84
84
  "last_update" timestamp
85
85
 
86
- Indexes {
87
- (id, first_name) [type: btree]
88
- }
86
+ Indexes {
87
+ (id, first_name) [type: btree]
88
+ }
89
89
  }
90
90
 
91
91
  Ref:"country"."id" < "city"."country_id"
@@ -84,9 +84,9 @@ Table "customer" {
84
84
  "create_Date" timestamp
85
85
  "last_update" timestamp
86
86
 
87
- Indexes {
88
- (id, first_name) [type: btree]
89
- }
87
+ Indexes {
88
+ (id, first_name) [type: btree]
89
+ }
90
90
  }
91
91
 
92
92
  Ref:"country"."id" < "city"."country_id"
@@ -84,9 +84,9 @@ Table "customer" {
84
84
  "create_Date" timestamp
85
85
  "last_update" timestamp
86
86
 
87
- Indexes {
88
- (id, first_name) [type: btree]
89
- }
87
+ Indexes {
88
+ (id, first_name) [type: btree]
89
+ }
90
90
  }
91
91
 
92
92
  Ref:"country"."id" < "city"."country_id"
@@ -80,9 +80,9 @@ Table "ecommerce"."users" {
80
80
  "eg" ecommerce_users_eg_enum [not null]
81
81
  "eg2" ecommerce_users_eg2_enum [not null]
82
82
 
83
- Indexes {
84
- (name, ejs) [name: "idx_1"]
85
- }
83
+ Indexes {
84
+ (name, ejs) [name: "idx_1"]
85
+ }
86
86
  Note: 'Note on table users of schema ecommerce'
87
87
  }
88
88
 
@@ -93,9 +93,9 @@ Table "schemaA"."products" {
93
93
  "lid" int
94
94
  "lid2" int
95
95
 
96
- Indexes {
97
- (lid, lid2) [unique, name: "unique_lid_lid2"]
98
- }
96
+ Indexes {
97
+ (lid, lid2) [unique, name: "unique_lid_lid2"]
98
+ }
99
99
  Note: 'Note on table products of schemaA'
100
100
  }
101
101
 
@@ -80,9 +80,9 @@ Table "ecommerce"."users" {
80
80
  "eg" ecommerce_users_eg_enum [not null]
81
81
  "eg2" ecommerce_users_eg2_enum [not null]
82
82
 
83
- Indexes {
84
- (name, ejs) [name: "idx_1"]
85
- }
83
+ Indexes {
84
+ (name, ejs) [name: "idx_1"]
85
+ }
86
86
  Note: 'Note on table users of schema ecommerce'
87
87
  }
88
88
 
@@ -93,9 +93,9 @@ Table "schemaA"."products" {
93
93
  "lid" int
94
94
  "lid2" int
95
95
 
96
- Indexes {
97
- (lid, lid2) [unique, name: "unique_lid_lid2"]
98
- }
96
+ Indexes {
97
+ (lid, lid2) [unique, name: "unique_lid_lid2"]
98
+ }
99
99
  Note: 'Note on table products of schemaA'
100
100
  }
101
101
 
@@ -43,11 +43,11 @@ Table "orders" {
43
43
  "name" varchar(255)
44
44
  "name2" varchar(255)
45
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
- }
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
51
  Note: 'this is table orders'
52
52
  }
53
53
 
@@ -56,18 +56,18 @@ Table "orders2" {
56
56
  "id2" int
57
57
  "pid" int
58
58
 
59
- Indexes {
60
- (id1, id2) [pk, name: "testCPK"]
61
- }
59
+ Indexes {
60
+ (id1, id2) [pk, name: "testCPK"]
61
+ }
62
62
  }
63
63
 
64
64
  Table "orders4" {
65
65
  "id1" int
66
66
  "id2" int
67
67
 
68
- Indexes {
69
- (id1, id2) [pk, name: "PK_orders4_id1_id2"]
70
- }
68
+ Indexes {
69
+ (id1, id2) [pk, name: "PK_orders4_id1_id2"]
70
+ }
71
71
  }
72
72
 
73
73
  Ref "FK_1":"schemaA"."locations"."id" < "schemaA"."products"."lid" [delete: cascade]
@@ -43,11 +43,11 @@ Table "orders" {
43
43
  "name" varchar(255)
44
44
  "name2" varchar(255)
45
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
- }
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
51
  Note: 'this is table orders'
52
52
  }
53
53
 
@@ -56,18 +56,18 @@ Table "orders2" {
56
56
  "id2" int
57
57
  "pid" int
58
58
 
59
- Indexes {
60
- (id1, id2) [pk, name: "testCPK"]
61
- }
59
+ Indexes {
60
+ (id1, id2) [pk, name: "testCPK"]
61
+ }
62
62
  }
63
63
 
64
64
  Table "orders4" {
65
65
  "id1" int
66
66
  "id2" int
67
67
 
68
- Indexes {
69
- (id1, id2) [pk, name: "PK_orders4_id1_id2"]
70
- }
68
+ Indexes {
69
+ (id1, id2) [pk, name: "PK_orders4_id1_id2"]
70
+ }
71
71
  }
72
72
 
73
73
  Ref "FK_1":"schemaA"."locations"."id" < "schemaA"."products"."lid" [delete: cascade]
@@ -31,9 +31,9 @@ Table "products" {
31
31
  "id" int [pk]
32
32
  "name" varchar [note: 'Product name of table products in public schema']
33
33
 
34
- Indexes {
35
- id [type: hash, unique]
36
- }
34
+ Indexes {
35
+ id [type: hash, unique]
36
+ }
37
37
  }
38
38
 
39
39
  Table "booking_reference" {
@@ -41,9 +41,9 @@ Table "booking_reference" {
41
41
  "cust_id" NUMBER(10) [not null]
42
42
  "status" NVARCHAR(1) [not null]
43
43
 
44
- Indexes {
45
- (reference_id, cust_id) [pk]
46
- }
44
+ Indexes {
45
+ (reference_id, cust_id) [pk]
46
+ }
47
47
  }
48
48
 
49
49
  Table "br_flight" {
@@ -51,9 +51,9 @@ Table "br_flight" {
51
51
  "cust_id" NUMBER(10) [not null]
52
52
  "flight_id" NVARCHAR(10) [not null]
53
53
 
54
- Indexes {
55
- (reference_id, flight_id) [pk]
56
- }
54
+ Indexes {
55
+ (reference_id, flight_id) [pk]
56
+ }
57
57
  }
58
58
 
59
59
  Ref "fk_1":"schemaA"."locations"."id" < "schemaA"."products"."lid"
@@ -89,9 +89,9 @@ Table "schemaA"."products" {
89
89
  "name" varchar [note: 'Product name of schemaA']
90
90
  "lid" int
91
91
 
92
- Indexes {
93
- (id, name) [name: "product_status"]
94
- }
92
+ Indexes {
93
+ (id, name) [name: "product_status"]
94
+ }
95
95
  }
96
96
 
97
97
  Table "schemaA"."locations" {
@@ -31,9 +31,9 @@ Table "products" {
31
31
  "id" int [pk]
32
32
  "name" varchar [note: 'Product name of table products in public schema']
33
33
 
34
- Indexes {
35
- id [type: hash, unique]
36
- }
34
+ Indexes {
35
+ id [type: hash, unique]
36
+ }
37
37
  }
38
38
 
39
39
  Table "booking_reference" {
@@ -41,9 +41,9 @@ Table "booking_reference" {
41
41
  "cust_id" NUMBER(10) [not null]
42
42
  "status" NVARCHAR(1) [not null]
43
43
 
44
- Indexes {
45
- (reference_id, cust_id) [pk]
46
- }
44
+ Indexes {
45
+ (reference_id, cust_id) [pk]
46
+ }
47
47
  }
48
48
 
49
49
  Table "br_flight" {
@@ -51,9 +51,9 @@ Table "br_flight" {
51
51
  "cust_id" NUMBER(10) [not null]
52
52
  "flight_id" NVARCHAR(10) [not null]
53
53
 
54
- Indexes {
55
- (reference_id, flight_id) [pk]
56
- }
54
+ Indexes {
55
+ (reference_id, flight_id) [pk]
56
+ }
57
57
  }
58
58
 
59
59
  Ref "fk_1":"schemaA"."locations"."id" < "schemaA"."products"."lid"
@@ -89,9 +89,9 @@ Table "schemaA"."products" {
89
89
  "name" varchar [note: 'Product name of schemaA']
90
90
  "lid" int
91
91
 
92
- Indexes {
93
- (id, name) [name: "product_status"]
94
- }
92
+ Indexes {
93
+ (id, name) [name: "product_status"]
94
+ }
95
95
  }
96
96
 
97
97
  Table "schemaA"."locations" {
@@ -1546,3 +1546,6 @@ undefined
1546
1546
  2024-03-19T03:39:41.760Z
1547
1547
  undefined
1548
1548
 
1549
+ 2024-04-26T07:10:16.198Z
1550
+ undefined
1551
+
@@ -1604,3 +1604,6 @@ Error: Reference with the same endpoints already exists: "student"("subject_id",
1604
1604
  at Object._import [as import] (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/import/index.js:11:43)
1605
1605
  {"start":{"offset":407,"line":17,"column":25},"end":{"offset":488,"line":17,"column":106}}
1606
1606
 
1607
+ 2024-04-26T07:10:16.559Z
1608
+ undefined
1609
+
@@ -1604,3 +1604,6 @@ Error: Reference with the same endpoints already exists: "student"("subject_id",
1604
1604
  at Object._import [as import] (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-core/lib/import/index.js:11:43)
1605
1605
  {"start":{"line":1,"column":1}}
1606
1606
 
1607
+ 2024-04-26T07:10:17.110Z
1608
+ undefined
1609
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/cli",
3
- "version": "3.4.2",
3
+ "version": "3.5.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@babel/cli": "^7.21.0",
28
- "@dbml/core": "^3.4.2",
28
+ "@dbml/core": "^3.5.0",
29
29
  "bluebird": "^3.5.5",
30
30
  "chalk": "^2.4.2",
31
31
  "commander": "^2.20.0",
@@ -53,5 +53,5 @@
53
53
  "^.+\\.js$": "babel-jest"
54
54
  }
55
55
  },
56
- "gitHead": "69c7433c7460b9840f504bc0b1364acd48a066a9"
56
+ "gitHead": "8019ecd08dac769d4c448c401faed4cc90bed92b"
57
57
  }