@dbml/cli 6.4.0 → 6.6.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 (74) hide show
  1. package/__test__/db2dbml/mssql/dbml-error.log +22 -0
  2. package/__test__/db2dbml/mysql/dbml-error.log +6 -0
  3. package/__test__/db2dbml/oracle/dbml-error.log +11 -0
  4. package/__test__/db2dbml/oracle/out-files/schema.dbml +46 -0
  5. package/__test__/db2dbml/postgres/dbml-error.log +7 -0
  6. package/__test__/db2dbml/sqlite/dbml-error.log +52 -0
  7. package/__test__/db2dbml/sqlite/out-files/schema.dbml +108 -0
  8. package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -0
  9. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +65 -0
  10. package/__test__/dbml2sql/filename --mysql stdout/dbml-error.log +0 -0
  11. package/__test__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
  12. package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +61 -0
  13. package/__test__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
  14. package/__test__/dbml2sql/filename --out-file/dbml-error.log +0 -0
  15. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +77 -0
  16. package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -0
  17. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +77 -0
  18. package/__test__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
  19. package/__test__/dbml2sql/filename stdout/dbml-error.log +0 -0
  20. package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -0
  21. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +172 -0
  22. package/__test__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
  23. package/__test__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
  24. package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +172 -0
  25. package/__test__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
  26. package/__test__/dbml2sql/filenames --out-file/dbml-error.log +0 -0
  27. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +172 -0
  28. package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -0
  29. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +172 -0
  30. package/__test__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
  31. package/__test__/dbml2sql/filenames stdout/dbml-error.log +0 -0
  32. package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -0
  33. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +62 -0
  34. package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -0
  35. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +50 -0
  36. package/__test__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
  37. package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +88 -0
  38. package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -0
  39. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +67 -0
  40. package/__test__/dbml2sql/syntax-error/dbml-error.log +1533 -0
  41. package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -0
  42. package/__test__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +25 -0
  43. package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -0
  44. package/__test__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +74 -0
  45. package/__test__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
  46. package/__test__/sql2dbml/filename --out-file/dbml-error.log +0 -0
  47. package/__test__/sql2dbml/filename --out-file/out-files/schema.dbml +74 -0
  48. package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -0
  49. package/__test__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +74 -0
  50. package/__test__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
  51. package/__test__/sql2dbml/filename --snowflake stdout/dbml-error.log +0 -0
  52. package/__test__/sql2dbml/filename stdout/dbml-error.log +0 -0
  53. package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -0
  54. package/__test__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +170 -0
  55. package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
  56. package/__test__/sql2dbml/filenames --out-file/dbml-error.log +0 -0
  57. package/__test__/sql2dbml/filenames --out-file/out-files/schema.dbml +170 -0
  58. package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -0
  59. package/__test__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +170 -0
  60. package/__test__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
  61. package/__test__/sql2dbml/filenames stdout/dbml-error.log +0 -0
  62. package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -0
  63. package/__test__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +106 -0
  64. package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -0
  65. package/__test__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +136 -0
  66. package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +52 -0
  67. package/__test__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +101 -0
  68. package/__test__/sql2dbml/syntax-error/dbml-error.log +1557 -0
  69. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +1615 -0
  70. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +1615 -0
  71. package/dbml-error.log +562 -0
  72. package/lib/index.js +4 -4
  73. package/package.json +4 -4
  74. package/yarn-error.log +87 -0
@@ -0,0 +1,22 @@
1
+ 2025-08-04T05:04:14.276Z
2
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
3
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
4
+ at Connection.onConnect (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
5
+ at Object.onceWrapper (node:events:633:26)
6
+ at Connection.emit (node:events:518:28)
7
+ at Connection.emit (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
8
+ at Connection.socketError (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
9
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
10
+ at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
11
+
12
+ 2025-08-04T05:10:48.040Z
13
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
14
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
15
+ at Connection.onConnect (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
16
+ at Object.onceWrapper (node:events:633:26)
17
+ at Connection.emit (node:events:518:28)
18
+ at Connection.emit (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
19
+ at Connection.socketError (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
20
+ at /Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
21
+ at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
22
+
@@ -0,0 +1,6 @@
1
+ 2025-08-04T05:04:14.971Z
2
+ undefined
3
+
4
+ 2025-08-04T05:10:48.738Z
5
+ undefined
6
+
@@ -0,0 +1,11 @@
1
+ 2025-08-15T09:51:19.619Z
2
+ Error: ORA-01017: invalid credential or not authorized; logon denied
3
+ Help: https://docs.oracle.com/error-help/db/ora-01017/
4
+ at Protocol._processMessage (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/oracledb/lib/thin/protocol/protocol.js:204:17)
5
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
6
+ at async ThinConnectionImpl.connect (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/oracledb/lib/thin/connection.js:896:9)
7
+ at async Object.getConnection (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/oracledb/lib/oracledb.js:788:3)
8
+ at async Object.getConnection (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/oracledb/lib/util.js:298:16)
9
+ at async fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/oracleConnector.js:344:18)
10
+ at async connectionHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:24)
11
+
@@ -0,0 +1,46 @@
1
+ Table "TEST"."category" {
2
+ "cat_id" NUMBER [pk, not null, increment]
3
+ "cat_name" NVARCHAR2(100) [not null]
4
+ "super_cat_id" NUMBER
5
+ "created_date" TIMESTAMP(6) [default: current_timestamp
6
+ ]
7
+ Note: 'Category is stored as tree like structure'
8
+ }
9
+
10
+ Table "TEST"."product" {
11
+ "product_id" NUMBER [pk, not null, increment]
12
+ "product_name" NVARCHAR2(510) [not null]
13
+ "current_price" FLOAT [not null]
14
+ "cat_id" NUMBER [not null]
15
+ "is_sold" NUMBER(1)
16
+ "created_date" TIMESTAMP(6) [default: current_timestamp]
17
+ "is_allow_all" NUMBER(1)
18
+ }
19
+
20
+ Table "TEST"."user" {
21
+ "user_id" NUMBER [pk, not null, increment]
22
+ "username" VARCHAR2(40) [not null]
23
+ "password" VARCHAR2(255) [not null]
24
+ "email" NVARCHAR2(80) [not null]
25
+ "role" NUMBER [default: 0]
26
+ "created_date" TIMESTAMP(6) [default: current_timestamp
27
+ ]
28
+
29
+ Indexes {
30
+ username [type: normal, unique, name: "SYS_C008730"]
31
+ email [type: normal, unique, name: "SYS_C008731"]
32
+ }
33
+ }
34
+
35
+ Table "TEST"."wishlist" {
36
+ "user_id" NUMBER [pk, not null]
37
+ "product_id" NUMBER [pk, not null]
38
+ }
39
+
40
+ Ref "FK_CATEGORY_SUPER":"TEST"."category"."cat_id" < "TEST"."category"."super_cat_id"
41
+
42
+ Ref "FK_PRODUCT_CATEGORY":"TEST"."category"."cat_id" < "TEST"."product"."cat_id"
43
+
44
+ Ref "FK_WISHLIST_PRODUCT":"TEST"."product"."product_id" < "TEST"."wishlist"."product_id"
45
+
46
+ Ref "FK_WISHLIST_USER":"TEST"."user"."user_id" < "TEST"."wishlist"."user_id"
@@ -0,0 +1,7 @@
1
+ 2025-08-04T05:04:15.719Z
2
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
3
+ at getValidatedClient (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/postgresConnector.js:21:19)
4
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
5
+ at async fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/postgresConnector.js:415:20)
6
+ at async connectionHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:25:24)
7
+
@@ -0,0 +1,52 @@
1
+ 2025-08-04T05:11:04.754Z
2
+ SqliteError: file is not a database
3
+ at Database.prepare (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/better-sqlite3/lib/methods/wrappers.js:5:21)
4
+ at generateTablesAndEnums (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:161:23)
5
+ at fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:303:58)
6
+ at Object.fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:24:58)
7
+ at connectionHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:25:51)
8
+ at Object.db2dbml (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/index.js:67:26)
9
+ at Object.<anonymous> (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
10
+ at Module._compile (node:internal/modules/cjs/loader:1730:14)
11
+ at Object..js (node:internal/modules/cjs/loader:1895:10)
12
+ at Module.load (node:internal/modules/cjs/loader:1465:32)
13
+
14
+ 2025-08-04T05:11:51.381Z
15
+ SqliteError: file is not a database
16
+ at Database.prepare (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/better-sqlite3/lib/methods/wrappers.js:5:21)
17
+ at generateTablesAndEnums (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:161:23)
18
+ at fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:303:58)
19
+ at Object.fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:24:58)
20
+ at connectionHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
21
+ at Object.db2dbml (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/index.js:67:26)
22
+ at Object.<anonymous> (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
23
+ at Module._compile (node:internal/modules/cjs/loader:1730:14)
24
+ at Object..js (node:internal/modules/cjs/loader:1895:10)
25
+ at Module.load (node:internal/modules/cjs/loader:1465:32)
26
+
27
+ 2025-08-04T05:12:18.072Z
28
+ SqliteError: file is not a database
29
+ at Database.prepare (/Users/nguyenhoang/Documents/workspace/dbx/dbml/node_modules/better-sqlite3/lib/methods/wrappers.js:5:21)
30
+ at generateTablesAndEnums (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:133:23)
31
+ at fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:273:58)
32
+ at Object.fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:24:58)
33
+ at connectionHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
34
+ at Object.db2dbml (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/index.js:67:26)
35
+ at Object.<anonymous> (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
36
+ at Module._compile (node:internal/modules/cjs/loader:1730:14)
37
+ at Object..js (node:internal/modules/cjs/loader:1895:10)
38
+ at Module.load (node:internal/modules/cjs/loader:1465:32)
39
+
40
+ 2025-08-15T10:09:49.169Z
41
+ Error: SQLite connection error: unable to open database file
42
+ at connectSQLite (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:37:19)
43
+ at fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/sqliteConnector.js:306:16)
44
+ at Object.fetchSchemaJson (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:24:58)
45
+ at connectionHandler (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
46
+ at Object.db2dbml (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/lib/cli/index.js:67:26)
47
+ at Object.<anonymous> (/Users/nguyenhoang/Documents/workspace/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
48
+ at Module._compile (node:internal/modules/cjs/loader:1730:14)
49
+ at Object..js (node:internal/modules/cjs/loader:1895:10)
50
+ at Module.load (node:internal/modules/cjs/loader:1465:32)
51
+ at Function._load (node:internal/modules/cjs/loader:1282:12)
52
+
@@ -0,0 +1,108 @@
1
+ Table "main"."Customers" {
2
+ "customer_id" INTEGER [pk, increment]
3
+ "first_name" VARCHAR(50) [not null]
4
+ "last_name" VARCHAR(50) [not null]
5
+ "gender" STRING
6
+ "household_income" INTEGER
7
+ "birthdate" DATE [not null]
8
+ "phone_number" INTEGER [not null]
9
+ "email" VARCHAR(128)
10
+ }
11
+
12
+ Table "main"."Car_Vins" {
13
+ "vin" INTEGER [pk, increment]
14
+ "model_id" INTEGER [not null]
15
+ "option_set_id" INTEGER [not null]
16
+ "manufactured_date" DATE [not null]
17
+ "manufactured_plant_id" INTEGER [not null]
18
+ }
19
+
20
+ Table "main"."Car_Options" {
21
+ "option_set_id" INTEGER [pk, increment]
22
+ "model_id" INTEGER
23
+ "engine_id" INTEGER [not null]
24
+ "transmission_id" INTEGER [not null]
25
+ "chassis_id" INTEGER [not null]
26
+ "premium_sound_id" INTEGER
27
+ "color" VARCHAR(30) [not null]
28
+ "option_set_price" INTEGER [not null]
29
+ }
30
+
31
+ Table "main"."Car_Parts" {
32
+ "part_id" INTEGER [pk, increment]
33
+ "part_name" VARCHAR(100) [not null]
34
+ "manufacture_plant_id" INTEGER [not null]
35
+ "manufacture_start_date" DATE [not null]
36
+ "manufacture_end_date" DATE
37
+ "part_recall" INTEGER [default: 0]
38
+ }
39
+
40
+ Table "main"."Brands" {
41
+ "brand_id" INTEGER [pk, increment]
42
+ "brand_name" VARCHAR(50) [not null]
43
+ }
44
+
45
+ Table "main"."Models" {
46
+ "model_id" INTEGER [pk, increment]
47
+ "model_name" VARCHAR(50) [not null]
48
+ "model_base_price" INTEGER [not null]
49
+ "brand_id" INTEGER [not null]
50
+ }
51
+
52
+ Table "main"."Customer_Ownership" {
53
+ "customer_id" INTEGER [pk, not null, increment]
54
+ "vin" INTEGER [not null]
55
+ "purchase_date" DATE [not null]
56
+ "purchase_price" INTEGER [not null]
57
+ "warantee_expire_date" DATE
58
+ "dealer_id" INTEGER [not null]
59
+ }
60
+
61
+ Table "main"."Manufacture_Plant" {
62
+ "manufacture_plant_id" INTEGER [pk, increment]
63
+ "plant_name" VARCHAR(50) [not null]
64
+ "plant_type" "VARCHAR (7)"
65
+ "plant_location" VARCHAR(100)
66
+ "company_owned" INTEGER
67
+ }
68
+
69
+ Table "main"."Dealers" {
70
+ "dealer_id" INTEGER [pk, increment]
71
+ "dealer_name" VARCHAR(50) [not null]
72
+ "dealer_address" VARCHAR(100)
73
+ }
74
+
75
+ Table "main"."Dealer_Brand" {
76
+ "dealer_id" INTEGER [pk, not null, increment]
77
+ "brand_id" INTEGER [not null]
78
+ }
79
+
80
+ Ref "fk_Car_Vins_0":"main"."Car_Options"."option_set_id" < "main"."Car_Vins"."option_set_id"
81
+
82
+ Ref "fk_Car_Vins_1":"main"."Manufacture_Plant"."manufacture_plant_id" < "main"."Car_Vins"."manufactured_plant_id"
83
+
84
+ Ref "fk_Car_Vins_2":"main"."Models"."model_id" < "main"."Car_Vins"."model_id"
85
+
86
+ Ref "fk_Car_Options_0":"main"."Car_Parts"."part_id" < "main"."Car_Options"."chassis_id"
87
+
88
+ Ref "fk_Car_Options_1":"main"."Car_Parts"."part_id" < "main"."Car_Options"."transmission_id"
89
+
90
+ Ref "fk_Car_Options_2":"main"."Car_Parts"."part_id" < "main"."Car_Options"."premium_sound_id"
91
+
92
+ Ref "fk_Car_Options_3":"main"."Car_Parts"."part_id" < "main"."Car_Options"."engine_id"
93
+
94
+ Ref "fk_Car_Options_4":"main"."Models"."model_id" < "main"."Car_Options"."model_id"
95
+
96
+ Ref "fk_Car_Parts_0":"main"."Manufacture_Plant"."manufacture_plant_id" < "main"."Car_Parts"."manufacture_plant_id"
97
+
98
+ Ref "fk_Models_0":"main"."Brands"."brand_id" < "main"."Models"."brand_id"
99
+
100
+ Ref "fk_Customer_Ownership_0":"main"."Dealers"."dealer_id" < "main"."Customer_Ownership"."dealer_id"
101
+
102
+ Ref "fk_Customer_Ownership_1":"main"."Car_Vins"."vin" < "main"."Customer_Ownership"."vin"
103
+
104
+ Ref "fk_Customer_Ownership_2":"main"."Customers"."customer_id" < "main"."Customer_Ownership"."customer_id"
105
+
106
+ Ref "fk_Dealer_Brand_0":"main"."Brands"."brand_id" < "main"."Dealer_Brand"."brand_id"
107
+
108
+ Ref "fk_Dealer_Brand_1":"main"."Dealers"."dealer_id" < "main"."Dealer_Brand"."dealer_id"
@@ -0,0 +1,65 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: MySQL
3
+ -- Generated at: 2025-08-04T05:03:35.744Z
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`);
@@ -0,0 +1,61 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: Oracle
3
+ -- Generated at: 2025-08-04T05:03:37.497Z
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,77 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: PostgreSQL
3
+ -- Generated at: 2025-08-04T05:03:38.762Z
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" INT GENERATED BY DEFAULT AS IDENTITY 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");
@@ -0,0 +1,77 @@
1
+ -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
+ -- Database: PostgreSQL
3
+ -- Generated at: 2025-08-04T05:03:39.407Z
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" INT GENERATED BY DEFAULT AS IDENTITY 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");