@dbml/cli 3.3.0 → 3.4.1-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/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +36 -0
- package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
- package/__test__/dbml2sql/filename --oracle --out-file/expect-out-files/schema.sql +57 -0
- package/__test__/dbml2sql/filename --oracle --out-file/in-files/schema.dbml +71 -0
- package/__test__/dbml2sql/filename --oracle --out-file/options.json +8 -0
- package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +61 -0
- package/__test__/dbml2sql/filename --oracle --out-file/stdout.txt +1 -0
- package/__test__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filename --oracle stdout/in-files/schema.dbml +71 -0
- package/__test__/dbml2sql/filename --oracle stdout/options.json +6 -0
- package/__test__/dbml2sql/filename --oracle stdout/stdout.txt +58 -0
- package/__test__/dbml2sql/filename --out-file/dbml-error.log +36 -0
- package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/expect-out-files/schema.sql +168 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/in-files/business.dbml +40 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/in-files/customer.dbml +39 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/in-files/inventory.dbml +61 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/options.json +10 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +172 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/stdout.txt +1 -0
- package/__test__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames --oracle stdout/in-files/business.dbml +40 -0
- package/__test__/dbml2sql/filenames --oracle stdout/in-files/customer.dbml +39 -0
- package/__test__/dbml2sql/filenames --oracle stdout/in-files/inventory.dbml +61 -0
- package/__test__/dbml2sql/filenames --oracle stdout/options.json +8 -0
- package/__test__/dbml2sql/filenames --oracle stdout/stdout.txt +171 -0
- package/__test__/dbml2sql/filenames --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +24 -0
- package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +2 -2
- package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +24 -0
- package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +2 -2
- package/__test__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
- package/__test__/dbml2sql/multiple_schema_oracle/expect-out-files/multiple_schema.out.sql +84 -0
- package/__test__/dbml2sql/multiple_schema_oracle/in-files/multiple_schema.in.dbml +45 -0
- package/__test__/dbml2sql/multiple_schema_oracle/options.json +8 -0
- package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +88 -0
- package/__test__/dbml2sql/multiple_schema_oracle/stdout.txt +1 -0
- package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +24 -0
- package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +2 -2
- package/__test__/dbml2sql/syntax-error/dbml-error.log +2158 -1074
- package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +51 -0
- package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filename --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +239 -0
- package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +218 -0
- package/__test__/sql2dbml/filenames --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +121 -0
- package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +104 -0
- package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +163 -32
- package/__test__/sql2dbml/syntax-error/dbml-error.log +2711 -1094
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +1990 -1130
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/stdout.txt +2 -1
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +1985 -1125
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/stdout.txt +2 -1
- package/bin/dbml-error.log +0 -0
- package/bin/dbml2sql.js +0 -0
- package/bin/sql2dbml.js +0 -0
- package/dbml-error.log +322 -258
- package/lib/cli/config.js +3 -0
- package/lib/cli/export.js +4 -3
- package/lib/cli/import.js +3 -3
- package/lib/cli/index.js +1 -1
- package/lib/cli/utils.js +9 -7
- package/package.json +3 -3
- package/src/cli/config.js +3 -0
- package/src/cli/export.js +9 -5
- package/src/cli/import.js +4 -5
- package/src/cli/index.js +1 -0
- package/src/cli/utils.js +5 -7
- package/yarn-error.log +0 -87
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
2021-07-13T12:37:40.734Z
|
|
2
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
3
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:56)
|
|
4
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
5
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
6
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
7
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
8
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
9
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
10
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
11
|
+
at internal/main/run_main_module.js:17:47
|
|
12
|
+
|
|
13
|
+
2021-07-13T12:47:15.905Z
|
|
14
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
15
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:56)
|
|
16
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
17
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
18
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
19
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
20
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
21
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
22
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
23
|
+
at internal/main/run_main_module.js:17:47
|
|
24
|
+
|
|
25
|
+
2021-07-13T12:58:20.418Z
|
|
26
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
27
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:49)
|
|
28
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
29
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
30
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
31
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
32
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
33
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
34
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
35
|
+
at internal/main/run_main_module.js:17:47
|
|
36
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml
|
|
1
|
+
-- SQL dump generated using DBML (dbml.dbdiagram.io)
|
|
2
2
|
-- Database: MySQL
|
|
3
|
-
-- Generated at: 2024-
|
|
3
|
+
-- Generated at: 2024-04-11T04:18:11.339Z
|
|
4
4
|
|
|
5
5
|
CREATE TABLE `orders` (
|
|
6
6
|
`id` int PRIMARY KEY AUTO_INCREMENT,
|
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
CREATE TABLE "orders" (
|
|
2
|
+
"id" int GENERATED AS IDENTITY PRIMARY KEY,
|
|
3
|
+
"user_id" int UNIQUE NOT NULL,
|
|
4
|
+
"status" nvarchar2(255) NOT NULL CHECK ("status" IN ('created', 'running', 'done', 'failure'))
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
CREATE TABLE "order_items" (
|
|
8
|
+
"order_id" int,
|
|
9
|
+
"product_id" int,
|
|
10
|
+
"quantity" int DEFAULT 1
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE TABLE "products" (
|
|
14
|
+
"id" int PRIMARY KEY,
|
|
15
|
+
"name" nvarchar2(255),
|
|
16
|
+
"merchant_id" int NOT NULL,
|
|
17
|
+
"price" int,
|
|
18
|
+
"status" nvarchar2(255) NOT NULL CHECK ("status" IN ('Out of Stock', 'In Stock')),
|
|
19
|
+
"created_at" timestamp DEFAULT current_timestamp
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE TABLE "users" (
|
|
23
|
+
"id" int PRIMARY KEY,
|
|
24
|
+
"full_name" nvarchar2(255),
|
|
25
|
+
"email" nvarchar2(255) UNIQUE,
|
|
26
|
+
"gender" nvarchar2(255),
|
|
27
|
+
"date_of_birth" date,
|
|
28
|
+
"created_at" timestamp,
|
|
29
|
+
"country_code" int
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE TABLE "merchants" (
|
|
33
|
+
"id" int PRIMARY KEY,
|
|
34
|
+
"merchant_name" nvarchar2(255),
|
|
35
|
+
"country_code" int,
|
|
36
|
+
"created_at" timestamp,
|
|
37
|
+
"admin_id" int
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE "countries" (
|
|
41
|
+
"code" int PRIMARY KEY,
|
|
42
|
+
"name" nvarchar2(255)
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
CREATE INDEX "product_status" ON "products" ("merchant_id", "status");
|
|
46
|
+
|
|
47
|
+
ALTER TABLE "order_items" ADD FOREIGN KEY ("order_id") REFERENCES "orders" ("id");
|
|
48
|
+
|
|
49
|
+
ALTER TABLE "order_items" ADD FOREIGN KEY ("product_id") REFERENCES "products" ("id");
|
|
50
|
+
|
|
51
|
+
ALTER TABLE "users" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
52
|
+
|
|
53
|
+
ALTER TABLE "merchants" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
54
|
+
|
|
55
|
+
ALTER TABLE "products" ADD FOREIGN KEY ("merchant_id") REFERENCES "merchants" ("id");
|
|
56
|
+
|
|
57
|
+
ALTER TABLE "merchants" ADD FOREIGN KEY ("admin_id") REFERENCES "users" ("id");
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Enum "orders_status" {
|
|
2
|
+
"created"
|
|
3
|
+
"running"
|
|
4
|
+
"done"
|
|
5
|
+
"failure"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
Enum "product status" {
|
|
9
|
+
"Out of Stock"
|
|
10
|
+
"In Stock"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Table "orders" {
|
|
14
|
+
"id" int [pk, increment]
|
|
15
|
+
"user_id" int [unique, not null]
|
|
16
|
+
"status" orders_status
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Table "order_items" {
|
|
20
|
+
"order_id" int
|
|
21
|
+
"product_id" int
|
|
22
|
+
"quantity" int [default: 1]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Table "products" {
|
|
26
|
+
"id" int [pk]
|
|
27
|
+
"name" nvarchar2(255)
|
|
28
|
+
"merchant_id" int [not null]
|
|
29
|
+
"price" int
|
|
30
|
+
"status" "product status"
|
|
31
|
+
"created_at" timestamp [default: `current_timestamp`]
|
|
32
|
+
|
|
33
|
+
Indexes {
|
|
34
|
+
(merchant_id, status) [name: "product_status"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Table "users" {
|
|
39
|
+
"id" int [pk]
|
|
40
|
+
"full_name" nvarchar2(255)
|
|
41
|
+
"email" nvarchar2(255) [unique]
|
|
42
|
+
"gender" nvarchar2(255)
|
|
43
|
+
"date_of_birth" date
|
|
44
|
+
"created_at" timestamp
|
|
45
|
+
"country_code" int
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Table "merchants" {
|
|
49
|
+
"id" int [pk]
|
|
50
|
+
"merchant_name" nvarchar2(255)
|
|
51
|
+
"country_code" int
|
|
52
|
+
"created_at" timestamp
|
|
53
|
+
"admin_id" int
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Table "countries" {
|
|
57
|
+
"code" int [pk]
|
|
58
|
+
"name" nvarchar2(255)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Ref:"orders"."id" < "order_items"."order_id"
|
|
62
|
+
|
|
63
|
+
Ref:"products"."id" < "order_items"."product_id"
|
|
64
|
+
|
|
65
|
+
Ref:"countries"."code" < "users"."country_code"
|
|
66
|
+
|
|
67
|
+
Ref:"countries"."code" < "merchants"."country_code"
|
|
68
|
+
|
|
69
|
+
Ref:"merchants"."id" < "products"."merchant_id"
|
|
70
|
+
|
|
71
|
+
Ref:"users"."id" < "merchants"."admin_id"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
-- SQL dump generated using DBML (dbml.dbdiagram.io)
|
|
2
|
+
-- Database: Oracle
|
|
3
|
+
-- Generated at: 2024-04-11T04:18:12.215Z
|
|
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");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
✔ Generated SQL dump file (Oracle): schema.sql
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Enum "orders_status" {
|
|
2
|
+
"created"
|
|
3
|
+
"running"
|
|
4
|
+
"done"
|
|
5
|
+
"failure"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
Enum "product status" {
|
|
9
|
+
"Out of Stock"
|
|
10
|
+
"In Stock"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Table "orders" {
|
|
14
|
+
"id" int [pk, increment]
|
|
15
|
+
"user_id" int [unique, not null]
|
|
16
|
+
"status" orders_status
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Table "order_items" {
|
|
20
|
+
"order_id" int
|
|
21
|
+
"product_id" int
|
|
22
|
+
"quantity" int [default: 1]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Table "products" {
|
|
26
|
+
"id" int [pk]
|
|
27
|
+
"name" nvarchar2(255)
|
|
28
|
+
"merchant_id" int [not null]
|
|
29
|
+
"price" int
|
|
30
|
+
"status" "product status"
|
|
31
|
+
"created_at" timestamp [default: `current_timestamp`]
|
|
32
|
+
|
|
33
|
+
Indexes {
|
|
34
|
+
(merchant_id, status) [name: "product_status"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Table "users" {
|
|
39
|
+
"id" int [pk]
|
|
40
|
+
"full_name" nvarchar2(255)
|
|
41
|
+
"email" nvarchar2(255) [unique]
|
|
42
|
+
"gender" nvarchar2(255)
|
|
43
|
+
"date_of_birth" date
|
|
44
|
+
"created_at" timestamp
|
|
45
|
+
"country_code" int
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Table "merchants" {
|
|
49
|
+
"id" int [pk]
|
|
50
|
+
"merchant_name" nvarchar2(255)
|
|
51
|
+
"country_code" int
|
|
52
|
+
"created_at" timestamp
|
|
53
|
+
"admin_id" int
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Table "countries" {
|
|
57
|
+
"code" int [pk]
|
|
58
|
+
"name" nvarchar2(255)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Ref:"orders"."id" < "order_items"."order_id"
|
|
62
|
+
|
|
63
|
+
Ref:"products"."id" < "order_items"."product_id"
|
|
64
|
+
|
|
65
|
+
Ref:"countries"."code" < "users"."country_code"
|
|
66
|
+
|
|
67
|
+
Ref:"countries"."code" < "merchants"."country_code"
|
|
68
|
+
|
|
69
|
+
Ref:"merchants"."id" < "products"."merchant_id"
|
|
70
|
+
|
|
71
|
+
Ref:"users"."id" < "merchants"."admin_id"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
CREATE TABLE "orders" (
|
|
2
|
+
"id" int GENERATED AS IDENTITY PRIMARY KEY,
|
|
3
|
+
"user_id" int UNIQUE NOT NULL,
|
|
4
|
+
"status" nvarchar2(255) NOT NULL CHECK ("status" IN ('created', 'running', 'done', 'failure'))
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
CREATE TABLE "order_items" (
|
|
8
|
+
"order_id" int,
|
|
9
|
+
"product_id" int,
|
|
10
|
+
"quantity" int DEFAULT 1
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE TABLE "products" (
|
|
14
|
+
"id" int PRIMARY KEY,
|
|
15
|
+
"name" nvarchar2(255),
|
|
16
|
+
"merchant_id" int NOT NULL,
|
|
17
|
+
"price" int,
|
|
18
|
+
"status" nvarchar2(255) NOT NULL CHECK ("status" IN ('Out of Stock', 'In Stock')),
|
|
19
|
+
"created_at" timestamp DEFAULT current_timestamp
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE TABLE "users" (
|
|
23
|
+
"id" int PRIMARY KEY,
|
|
24
|
+
"full_name" nvarchar2(255),
|
|
25
|
+
"email" nvarchar2(255) UNIQUE,
|
|
26
|
+
"gender" nvarchar2(255),
|
|
27
|
+
"date_of_birth" date,
|
|
28
|
+
"created_at" timestamp,
|
|
29
|
+
"country_code" int
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE TABLE "merchants" (
|
|
33
|
+
"id" int PRIMARY KEY,
|
|
34
|
+
"merchant_name" nvarchar2(255),
|
|
35
|
+
"country_code" int,
|
|
36
|
+
"created_at" timestamp,
|
|
37
|
+
"admin_id" int
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE "countries" (
|
|
41
|
+
"code" int PRIMARY KEY,
|
|
42
|
+
"name" nvarchar2(255)
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
CREATE INDEX "product_status" ON "products" ("merchant_id", "status");
|
|
46
|
+
|
|
47
|
+
ALTER TABLE "order_items" ADD FOREIGN KEY ("order_id") REFERENCES "orders" ("id");
|
|
48
|
+
|
|
49
|
+
ALTER TABLE "order_items" ADD FOREIGN KEY ("product_id") REFERENCES "products" ("id");
|
|
50
|
+
|
|
51
|
+
ALTER TABLE "users" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
52
|
+
|
|
53
|
+
ALTER TABLE "merchants" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
54
|
+
|
|
55
|
+
ALTER TABLE "products" ADD FOREIGN KEY ("merchant_id") REFERENCES "merchants" ("id");
|
|
56
|
+
|
|
57
|
+
ALTER TABLE "merchants" ADD FOREIGN KEY ("admin_id") REFERENCES "users" ("id");
|
|
58
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
2021-07-13T12:37:43.283Z
|
|
2
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
3
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:56)
|
|
4
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
5
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
6
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
7
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
8
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
9
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
10
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
11
|
+
at internal/main/run_main_module.js:17:47
|
|
12
|
+
|
|
13
|
+
2021-07-13T12:47:19.039Z
|
|
14
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
15
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:56)
|
|
16
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
17
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
18
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
19
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
20
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
21
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
22
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
23
|
+
at internal/main/run_main_module.js:17:47
|
|
24
|
+
|
|
25
|
+
2021-07-13T12:58:22.994Z
|
|
26
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
27
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:49)
|
|
28
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
29
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
30
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
31
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
32
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
33
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
34
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
35
|
+
at internal/main/run_main_module.js:17:47
|
|
36
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml
|
|
1
|
+
-- SQL dump generated using DBML (dbml.dbdiagram.io)
|
|
2
2
|
-- Database: PostgreSQL
|
|
3
|
-
-- Generated at: 2024-
|
|
3
|
+
-- Generated at: 2024-04-11T04:18:13.109Z
|
|
4
4
|
|
|
5
5
|
CREATE TYPE "orders_status" AS ENUM (
|
|
6
6
|
'created',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
2021-07-13T12:37:44.406Z
|
|
2
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
3
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:56)
|
|
4
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
5
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
6
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
7
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
8
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
9
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
10
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
11
|
+
at internal/main/run_main_module.js:17:47
|
|
12
|
+
|
|
13
|
+
2021-07-13T12:58:23.999Z
|
|
14
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
15
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:49)
|
|
16
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
17
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
18
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
19
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
20
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
21
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
22
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
23
|
+
at internal/main/run_main_module.js:17:47
|
|
24
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml
|
|
1
|
+
-- SQL dump generated using DBML (dbml.dbdiagram.io)
|
|
2
2
|
-- Database: PostgreSQL
|
|
3
|
-
-- Generated at: 2024-
|
|
3
|
+
-- Generated at: 2024-04-11T04:18:13.546Z
|
|
4
4
|
|
|
5
5
|
CREATE TYPE "orders_status" AS ENUM (
|
|
6
6
|
'created',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
2021-07-13T12:37:47.900Z
|
|
2
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
3
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:56)
|
|
4
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
5
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
6
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
7
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
8
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
9
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
10
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
11
|
+
at internal/main/run_main_module.js:17:47
|
|
12
|
+
|
|
13
|
+
2021-07-13T12:58:26.936Z
|
|
14
|
+
TypeError: Cannot read property 'tick' of undefined
|
|
15
|
+
at exportHandler (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\export.js:37:49)
|
|
16
|
+
at dbml2sql (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\src\cli\index.js:19:3)
|
|
17
|
+
at Object.<anonymous> (C:\Users\Inspiron101\Desktop\Holistics\dbml\packages\dbml-cli\__test__\dbml2sql_bin.js:5:1)
|
|
18
|
+
at Module._compile (internal/modules/cjs/loader.js:1085:14)
|
|
19
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
|
|
20
|
+
at Module.load (internal/modules/cjs/loader.js:950:32)
|
|
21
|
+
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
|
|
22
|
+
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
|
|
23
|
+
at internal/main/run_main_module.js:17:47
|
|
24
|
+
|
|
File without changes
|