@dbml/cli 2.4.2 → 2.4.4
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__/sql2dbml/multiple_schema_pg/expect-out-files/multiple_schema.out.dbml +33 -2
- package/__test__/sql2dbml/multiple_schema_pg/in-files/multiple_schema.in.sql +27 -2
- package/package.json +3 -3
- package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -36
- package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +0 -65
- package/__test__/dbml2sql/filename --mysql stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filename --out-file/dbml-error.log +0 -36
- package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +0 -77
- package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -24
- package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +0 -77
- package/__test__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filename stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -24
- package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +0 -172
- package/__test__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames --out-file/dbml-error.log +0 -24
- package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +0 -172
- package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -24
- package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +0 -172
- package/__test__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -24
- package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +0 -62
- package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -24
- package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +0 -50
- package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -24
- package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +0 -67
- package/__test__/dbml2sql/syntax-error/dbml-error.log +0 -2025
- package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -51
- package/__test__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +0 -25
- package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -24
- package/__test__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +0 -74
- package/__test__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
- package/__test__/sql2dbml/filename --out-file/dbml-error.log +0 -24
- package/__test__/sql2dbml/filename --out-file/out-files/schema.dbml +0 -74
- package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -24
- package/__test__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +0 -74
- package/__test__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
- package/__test__/sql2dbml/filename stdout/dbml-error.log +0 -0
- package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -24
- package/__test__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +0 -170
- package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
- package/__test__/sql2dbml/filenames --out-file/dbml-error.log +0 -24
- package/__test__/sql2dbml/filenames --out-file/out-files/schema.dbml +0 -170
- package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -24
- package/__test__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +0 -170
- package/__test__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
- package/__test__/sql2dbml/filenames stdout/dbml-error.log +0 -0
- package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -121
- package/__test__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +0 -106
- package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -104
- package/__test__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +0 -93
- package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +0 -131
- package/__test__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +0 -70
- package/__test__/sql2dbml/syntax-error/dbml-error.log +0 -1998
- package/dbml-error.log +0 -1142
|
@@ -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
|
-
|
|
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"
|
|
@@ -27,7 +27,14 @@ CREATE TABLE "users" (
|
|
|
27
27
|
"pjs" job_status,
|
|
28
28
|
"pjs2" job_status,
|
|
29
29
|
"pg" schemaB.gender,
|
|
30
|
-
"pg2" gender
|
|
30
|
+
"pg2" gender,
|
|
31
|
+
"country_code" int
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
CREATE TABLE "countries" (
|
|
35
|
+
"code" int PRIMARY KEY,
|
|
36
|
+
"name" varchar,
|
|
37
|
+
"continent_name" varchar
|
|
31
38
|
);
|
|
32
39
|
|
|
33
40
|
CREATE TABLE "products" (
|
|
@@ -48,7 +55,7 @@ CREATE TABLE "schemaA"."products" (
|
|
|
48
55
|
"id" int PRIMARY KEY,
|
|
49
56
|
"name" varchar,
|
|
50
57
|
"lid" int,
|
|
51
|
-
CONSTRAINT fk_1 FOREIGN KEY(lid) REFERENCES "schemaA"."locations"(id)
|
|
58
|
+
CONSTRAINT "fk_1" FOREIGN KEY(lid) REFERENCES "schemaA"."locations"(id)
|
|
52
59
|
);
|
|
53
60
|
|
|
54
61
|
CREATE TABLE "schemaA"."locations" (
|
|
@@ -56,6 +63,20 @@ CREATE TABLE "schemaA"."locations" (
|
|
|
56
63
|
"name" varchar
|
|
57
64
|
);
|
|
58
65
|
|
|
66
|
+
CREATE TABLE "booking_reference" (
|
|
67
|
+
"reference_id" NVARCHAR(10) NOT NULL,
|
|
68
|
+
"cust_id" NUMBER(10) NOT NULL,
|
|
69
|
+
"status" NVARCHAR (1) NOT NULL,
|
|
70
|
+
PRIMARY KEY ("reference_id", "cust_id")
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
CREATE TABLE "br_flight" (
|
|
74
|
+
"reference_id" NVARCHAR(10) NOT NULL ,
|
|
75
|
+
"cust_id" NUMBER(10)NOT NULL,
|
|
76
|
+
"flight_id" NVARCHAR (10) NOT NULL,
|
|
77
|
+
PRIMARY KEY ("reference_id", "flight_id")
|
|
78
|
+
);
|
|
79
|
+
|
|
59
80
|
CREATE INDEX "product_status" ON "schemaA"."products" ("id", "name");
|
|
60
81
|
|
|
61
82
|
CREATE UNIQUE INDEX ON "products" USING HASH ("id");
|
|
@@ -75,3 +96,7 @@ ALTER TABLE "ecommerce"."users" ADD CONSTRAINT "name_optional" FOREIGN KEY ("id"
|
|
|
75
96
|
ALTER TABLE "schemaA"."products" ADD FOREIGN KEY ("name") REFERENCES "ecommerce"."users" ("id");
|
|
76
97
|
|
|
77
98
|
ALTER TABLE "schemaA"."locations" ADD FOREIGN KEY ("name") REFERENCES "users" ("id");
|
|
99
|
+
|
|
100
|
+
ALTER TABLE "br_flight" ADD CONSTRAINT "fk_composite" FOREIGN KEY ("reference_id", "cust_id") REFERENCES "booking_reference";
|
|
101
|
+
|
|
102
|
+
ALTER TABLE "users" ADD CONSTRAINT "fk_country_code" FOREIGN KEY ("country_code") REFERENCES "countries";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/cli",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
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.5.5",
|
|
28
|
-
"@dbml/core": "^2.4.
|
|
28
|
+
"@dbml/core": "^2.4.3",
|
|
29
29
|
"bluebird": "^3.5.5",
|
|
30
30
|
"chalk": "^2.4.2",
|
|
31
31
|
"commander": "^2.20.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"^.+\\.js$": "babel-jest"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "39107aef57e41d29378ba15abe0c7057f7c5be00"
|
|
61
61
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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,65 +0,0 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml-lang.org)
|
|
2
|
-
-- Database: MySQL
|
|
3
|
-
-- Generated at: 2022-06-02T05:14:38.785Z
|
|
4
|
-
|
|
5
|
-
CREATE TABLE `orders` (
|
|
6
|
-
`id` int PRIMARY KEY AUTO_INCREMENT,
|
|
7
|
-
`user_id` int UNIQUE NOT NULL,
|
|
8
|
-
`status` ENUM ('created', 'running', 'done', 'failure'),
|
|
9
|
-
`created_at` varchar(255)
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE TABLE `order_items` (
|
|
13
|
-
`order_id` int,
|
|
14
|
-
`product_id` int,
|
|
15
|
-
`quantity` int DEFAULT 1
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
CREATE TABLE `products` (
|
|
19
|
-
`id` int PRIMARY KEY,
|
|
20
|
-
`name` varchar(255),
|
|
21
|
-
`merchant_id` int NOT NULL,
|
|
22
|
-
`price` int,
|
|
23
|
-
`status` ENUM ('Out of Stock', 'In Stock'),
|
|
24
|
-
`created_at` datetime DEFAULT (now())
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
CREATE TABLE `users` (
|
|
28
|
-
`id` int PRIMARY KEY,
|
|
29
|
-
`full_name` varchar(255),
|
|
30
|
-
`email` varchar(255) UNIQUE,
|
|
31
|
-
`gender` varchar(255),
|
|
32
|
-
`date_of_birth` varchar(255),
|
|
33
|
-
`created_at` varchar(255),
|
|
34
|
-
`country_code` int
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
CREATE TABLE `merchants` (
|
|
38
|
-
`id` int PRIMARY KEY,
|
|
39
|
-
`merchant_name` varchar(255),
|
|
40
|
-
`country_code` int,
|
|
41
|
-
`created_at` varchar(255),
|
|
42
|
-
`admin_id` int
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
CREATE TABLE `countries` (
|
|
46
|
-
`code` int PRIMARY KEY,
|
|
47
|
-
`name` varchar(255),
|
|
48
|
-
`continent_name` varchar(255)
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
CREATE INDEX `product_status` ON `products` (`merchant_id`, `status`);
|
|
52
|
-
|
|
53
|
-
CREATE UNIQUE INDEX `products_index_1` ON `products` (`id`) USING HASH;
|
|
54
|
-
|
|
55
|
-
ALTER TABLE `order_items` ADD FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`);
|
|
56
|
-
|
|
57
|
-
ALTER TABLE `order_items` ADD FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);
|
|
58
|
-
|
|
59
|
-
ALTER TABLE `users` ADD FOREIGN KEY (`country_code`) REFERENCES `countries` (`code`);
|
|
60
|
-
|
|
61
|
-
ALTER TABLE `merchants` ADD FOREIGN KEY (`country_code`) REFERENCES `countries` (`code`);
|
|
62
|
-
|
|
63
|
-
ALTER TABLE `products` ADD FOREIGN KEY (`merchant_id`) REFERENCES `merchants` (`id`);
|
|
64
|
-
|
|
65
|
-
ALTER TABLE `merchants` ADD FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`);
|
|
File without changes
|
|
@@ -1,36 +0,0 @@
|
|
|
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,77 +0,0 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml-lang.org)
|
|
2
|
-
-- Database: PostgreSQL
|
|
3
|
-
-- Generated at: 2022-06-02T05:14:43.919Z
|
|
4
|
-
|
|
5
|
-
CREATE TYPE "orders_status" AS ENUM (
|
|
6
|
-
'created',
|
|
7
|
-
'running',
|
|
8
|
-
'done',
|
|
9
|
-
'failure'
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE TYPE "product status" AS ENUM (
|
|
13
|
-
'Out of Stock',
|
|
14
|
-
'In Stock'
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
CREATE TABLE "orders" (
|
|
18
|
-
"id" SERIAL PRIMARY KEY,
|
|
19
|
-
"user_id" int UNIQUE NOT NULL,
|
|
20
|
-
"status" orders_status,
|
|
21
|
-
"created_at" varchar
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
CREATE TABLE "order_items" (
|
|
25
|
-
"order_id" int,
|
|
26
|
-
"product_id" int,
|
|
27
|
-
"quantity" int DEFAULT 1
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
CREATE TABLE "products" (
|
|
31
|
-
"id" int PRIMARY KEY,
|
|
32
|
-
"name" varchar,
|
|
33
|
-
"merchant_id" int NOT NULL,
|
|
34
|
-
"price" int,
|
|
35
|
-
"status" "product status",
|
|
36
|
-
"created_at" datetime DEFAULT (now())
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
CREATE TABLE "users" (
|
|
40
|
-
"id" int PRIMARY KEY,
|
|
41
|
-
"full_name" varchar,
|
|
42
|
-
"email" varchar UNIQUE,
|
|
43
|
-
"gender" varchar,
|
|
44
|
-
"date_of_birth" varchar,
|
|
45
|
-
"created_at" varchar,
|
|
46
|
-
"country_code" int
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
CREATE TABLE "merchants" (
|
|
50
|
-
"id" int PRIMARY KEY,
|
|
51
|
-
"merchant_name" varchar,
|
|
52
|
-
"country_code" int,
|
|
53
|
-
"created_at" varchar,
|
|
54
|
-
"admin_id" int
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
CREATE TABLE "countries" (
|
|
58
|
-
"code" int PRIMARY KEY,
|
|
59
|
-
"name" varchar,
|
|
60
|
-
"continent_name" varchar
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
CREATE INDEX "product_status" ON "products" ("merchant_id", "status");
|
|
64
|
-
|
|
65
|
-
CREATE UNIQUE INDEX ON "products" USING HASH ("id");
|
|
66
|
-
|
|
67
|
-
ALTER TABLE "order_items" ADD FOREIGN KEY ("order_id") REFERENCES "orders" ("id");
|
|
68
|
-
|
|
69
|
-
ALTER TABLE "order_items" ADD FOREIGN KEY ("product_id") REFERENCES "products" ("id");
|
|
70
|
-
|
|
71
|
-
ALTER TABLE "users" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
72
|
-
|
|
73
|
-
ALTER TABLE "merchants" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
74
|
-
|
|
75
|
-
ALTER TABLE "products" ADD FOREIGN KEY ("merchant_id") REFERENCES "merchants" ("id");
|
|
76
|
-
|
|
77
|
-
ALTER TABLE "merchants" ADD FOREIGN KEY ("admin_id") REFERENCES "users" ("id");
|
|
@@ -1,24 +0,0 @@
|
|
|
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,77 +0,0 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml-lang.org)
|
|
2
|
-
-- Database: PostgreSQL
|
|
3
|
-
-- Generated at: 2022-06-02T05:14:46.362Z
|
|
4
|
-
|
|
5
|
-
CREATE TYPE "orders_status" AS ENUM (
|
|
6
|
-
'created',
|
|
7
|
-
'running',
|
|
8
|
-
'done',
|
|
9
|
-
'failure'
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE TYPE "product status" AS ENUM (
|
|
13
|
-
'Out of Stock',
|
|
14
|
-
'In Stock'
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
CREATE TABLE "orders" (
|
|
18
|
-
"id" SERIAL PRIMARY KEY,
|
|
19
|
-
"user_id" int UNIQUE NOT NULL,
|
|
20
|
-
"status" orders_status,
|
|
21
|
-
"created_at" varchar
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
CREATE TABLE "order_items" (
|
|
25
|
-
"order_id" int,
|
|
26
|
-
"product_id" int,
|
|
27
|
-
"quantity" int DEFAULT 1
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
CREATE TABLE "products" (
|
|
31
|
-
"id" int PRIMARY KEY,
|
|
32
|
-
"name" varchar,
|
|
33
|
-
"merchant_id" int NOT NULL,
|
|
34
|
-
"price" int,
|
|
35
|
-
"status" "product status",
|
|
36
|
-
"created_at" datetime DEFAULT (now())
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
CREATE TABLE "users" (
|
|
40
|
-
"id" int PRIMARY KEY,
|
|
41
|
-
"full_name" varchar,
|
|
42
|
-
"email" varchar UNIQUE,
|
|
43
|
-
"gender" varchar,
|
|
44
|
-
"date_of_birth" varchar,
|
|
45
|
-
"created_at" varchar,
|
|
46
|
-
"country_code" int
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
CREATE TABLE "merchants" (
|
|
50
|
-
"id" int PRIMARY KEY,
|
|
51
|
-
"merchant_name" varchar,
|
|
52
|
-
"country_code" int,
|
|
53
|
-
"created_at" varchar,
|
|
54
|
-
"admin_id" int
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
CREATE TABLE "countries" (
|
|
58
|
-
"code" int PRIMARY KEY,
|
|
59
|
-
"name" varchar,
|
|
60
|
-
"continent_name" varchar
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
CREATE INDEX "product_status" ON "products" ("merchant_id", "status");
|
|
64
|
-
|
|
65
|
-
CREATE UNIQUE INDEX ON "products" USING HASH ("id");
|
|
66
|
-
|
|
67
|
-
ALTER TABLE "order_items" ADD FOREIGN KEY ("order_id") REFERENCES "orders" ("id");
|
|
68
|
-
|
|
69
|
-
ALTER TABLE "order_items" ADD FOREIGN KEY ("product_id") REFERENCES "products" ("id");
|
|
70
|
-
|
|
71
|
-
ALTER TABLE "users" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
72
|
-
|
|
73
|
-
ALTER TABLE "merchants" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("code");
|
|
74
|
-
|
|
75
|
-
ALTER TABLE "products" ADD FOREIGN KEY ("merchant_id") REFERENCES "merchants" ("id");
|
|
76
|
-
|
|
77
|
-
ALTER TABLE "merchants" ADD FOREIGN KEY ("admin_id") REFERENCES "users" ("id");
|
|
File without changes
|
|
File without changes
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
-- SQL dump generated using DBML (dbml-lang.org)
|
|
2
|
-
-- Database: MySQL
|
|
3
|
-
-- Generated at: 2022-06-02T05:14:54.361Z
|
|
4
|
-
|
|
5
|
-
CREATE TABLE `staff` (
|
|
6
|
-
`id` int PRIMARY KEY,
|
|
7
|
-
`first_name` varchar(255),
|
|
8
|
-
`last_name` varchar(255),
|
|
9
|
-
`address_id` int,
|
|
10
|
-
`picture` blob,
|
|
11
|
-
`email` varchar(255),
|
|
12
|
-
`store_id` int,
|
|
13
|
-
`active` boolean,
|
|
14
|
-
`user_name` varchar(255),
|
|
15
|
-
`password` varchar(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` decimal,
|
|
32
|
-
`payment_date` datetime,
|
|
33
|
-
`last_update` timestamp
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
CREATE TABLE `rental` (
|
|
37
|
-
`id` int PRIMARY KEY,
|
|
38
|
-
`rental_date` datetime,
|
|
39
|
-
`inventory_id` int,
|
|
40
|
-
`customer_id` int,
|
|
41
|
-
`return_date` ddatetime,
|
|
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` varchar(255),
|
|
58
|
-
`last_update` timestamp
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
CREATE TABLE `city` (
|
|
62
|
-
`id` int PRIMARY KEY,
|
|
63
|
-
`city` varchar(255),
|
|
64
|
-
`country_id` int,
|
|
65
|
-
`last_update` timestamp
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
CREATE TABLE `address` (
|
|
69
|
-
`id` int PRIMARY KEY,
|
|
70
|
-
`address` varchar(255),
|
|
71
|
-
`address2` varchar(255),
|
|
72
|
-
`district` varchar(255),
|
|
73
|
-
`city_id` int,
|
|
74
|
-
`postal_code` varchar(255),
|
|
75
|
-
`phone` varchar(255),
|
|
76
|
-
`last_update` timestamp
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
CREATE TABLE `customer` (
|
|
80
|
-
`id` int PRIMARY KEY,
|
|
81
|
-
`store_id` int,
|
|
82
|
-
`first_name` varchar(255),
|
|
83
|
-
`last_name` varchar(255),
|
|
84
|
-
`email` varchar(255),
|
|
85
|
-
`address_id` int,
|
|
86
|
-
`active` boolean,
|
|
87
|
-
`create_Date` timestamp,
|
|
88
|
-
`last_update` timestamp
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
CREATE INDEX `customer_index_0` ON `customer` (`id`, `first_name`) USING BTREE;
|
|
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` varchar(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` varchar(255),
|
|
113
|
-
`last_update` timestamp
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
CREATE TABLE `film_text` (
|
|
117
|
-
`id` int PRIMARY KEY,
|
|
118
|
-
`film_id` int,
|
|
119
|
-
`title` varchar(255),
|
|
120
|
-
`description` text
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
CREATE TABLE `actor` (
|
|
124
|
-
`id` int PRIMARY KEY,
|
|
125
|
-
`first_name` varchar(255),
|
|
126
|
-
`last_name` varchar(255),
|
|
127
|
-
`last_update` timestamp
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
CREATE TABLE `film` (
|
|
131
|
-
`id` int PRIMARY KEY,
|
|
132
|
-
`title` varchar(255),
|
|
133
|
-
`description` text,
|
|
134
|
-
`releaase_year` int,
|
|
135
|
-
`language_id` int,
|
|
136
|
-
`original_language_id` int,
|
|
137
|
-
`rental_duration` int,
|
|
138
|
-
`rental_rate` decimal,
|
|
139
|
-
`length` int,
|
|
140
|
-
`replacement_cost` decimal,
|
|
141
|
-
`rating` varchar(255),
|
|
142
|
-
`special_feature` varchar(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 `inventory` (`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`);
|
|
File without changes
|