@dbml/cli 5.0.0-alpha.0 → 5.0.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 (20) hide show
  1. package/__test__/db2dbml/mssql/out-files/schema.dbml +13 -13
  2. package/__test__/db2dbml/mysql/out-files/schema.dbml +4 -4
  3. package/__test__/db2dbml/postgres/out-files/schema.dbml +11 -11
  4. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  5. package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +1 -1
  6. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  7. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  8. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  9. package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +1 -1
  10. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  11. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  12. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  13. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  14. package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +1 -1
  15. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  16. package/__test__/dbml2sql/syntax-error/dbml-error.log +3 -0
  17. package/__test__/sql2dbml/syntax-error/dbml-error.log +3 -0
  18. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +3 -0
  19. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +3 -0
  20. package/package.json +4 -4
@@ -1,13 +1,13 @@
1
1
  Table "dbo"."users" {
2
2
  "user_id" int(10) [pk, not null, increment]
3
3
  "username" varchar(50) [unique, not null]
4
- "email" varchar(100) [unique, not null, constraint: `[email] like '%_@_%._%'`]
4
+ "email" varchar(100) [unique, not null, check: `[email] like '%_@_%._%'`]
5
5
  "password_hash" varchar(255) [not null]
6
6
  "first_name" varchar(50)
7
7
  "last_name" varchar(50)
8
8
  "full_name" varchar(100)
9
9
  "full_name_lower" varchar(100)
10
- "date_of_birth" date [constraint: `[date_of_birth]<=dateadd(year,(-13),getdate())`]
10
+ "date_of_birth" date [check: `[date_of_birth]<=dateadd(year,(-13),getdate())`]
11
11
  "created_at" datetime2 [default: `getdate()`]
12
12
  "last_login" datetime2
13
13
  "is_active" bit [default: 1]
@@ -23,8 +23,8 @@ Table "dbo"."products" {
23
23
  "product_id" int(10) [pk, not null, increment]
24
24
  "name" varchar(100) [not null]
25
25
  "description" text
26
- "price" decimal(10,2) [not null, constraint: `[price]>(0)`]
27
- "stock_quantity" int(10) [not null, constraint: `[stock_quantity]>=(0)`, default: 0]
26
+ "price" decimal(10,2) [not null, check: `[price]>(0)`]
27
+ "stock_quantity" int(10) [not null, check: `[stock_quantity]>=(0)`, default: 0]
28
28
  "category" varchar(50)
29
29
  "created_at" datetime2 [default: `getdate()`]
30
30
  "updated_at" datetime2 [default: `getdate()`]
@@ -39,8 +39,8 @@ Table "dbo"."orders" {
39
39
  "order_id" int(10) [pk, not null, increment]
40
40
  "user_id" int(10) [not null]
41
41
  "order_date" datetime2 [default: `getdate()`]
42
- "total_amount" decimal(12,2) [not null, constraint: `[total_amount]>(0)`]
43
- "status" varchar(20) [constraint: `[status]='cancelled' OR [status]='delivered' OR [status]='shipped' OR [status]='processing' OR [status]='pending'`, default: 'pending']
42
+ "total_amount" decimal(12,2) [not null, check: `[total_amount]>(0)`]
43
+ "status" varchar(20) [check: `[status]='cancelled' OR [status]='delivered' OR [status]='shipped' OR [status]='processing' OR [status]='pending'`, default: 'pending']
44
44
  "shipping_address" text [not null]
45
45
  "billing_address" text [not null]
46
46
 
@@ -53,8 +53,8 @@ Table "dbo"."order_items" {
53
53
  "order_item_id" int(10) [pk, not null, increment]
54
54
  "order_id" int(10) [unique, not null]
55
55
  "product_id" int(10) [unique, not null]
56
- "quantity" int(10) [not null, constraint: `[quantity]>(0)`]
57
- "unit_price" decimal(10,2) [not null, constraint: `[unit_price]>(0)`]
56
+ "quantity" int(10) [not null, check: `[quantity]>(0)`]
57
+ "unit_price" decimal(10,2) [not null, check: `[unit_price]>(0)`]
58
58
 
59
59
  Indexes {
60
60
  (order_id, product_id) [type: nonclustered, name: "idx_order_items_order_product"]
@@ -148,13 +148,13 @@ Table "dbo"."gender_reference" {
148
148
  Table "dbo"."user_define_data_types" {
149
149
  "id" int(10) [pk, not null, increment]
150
150
  "name" nvarchar(50)
151
- "gender" nvarchar(10) [constraint: `[gender]='Other' OR [gender]='Female' OR [gender]='Male'`]
151
+ "gender" nvarchar(10) [check: `[gender]='Other' OR [gender]='Female' OR [gender]='Male'`]
152
152
  "age_start" int(10)
153
153
  "age_end" int(10)
154
154
  "height" float(53)
155
155
  "weight" float(53)
156
156
 
157
- Constraints {
157
+ Checks {
158
158
  `[age_start]<=[age_end]` [name: 'chk_age_range']
159
159
  }
160
160
  }
@@ -186,7 +186,7 @@ Table "dbo"."AddressInfo" {
186
186
  "AddressID" uniqueidentifier(16) [not null]
187
187
  "AddressFormatID" uniqueidentifier(16) [not null]
188
188
 
189
- Constraints {
189
+ Checks {
190
190
  `([AddressID]='176029FA-D6D3-49E1-A48C-000000000002' OR [AddressID]='176029FA-D6D3-49E1-A48C-000000000001') AND ([AddressFormatID]='176029FA-D6D3-49E1-A48C-000000000002' OR [AddressFormatID]='176029FA-D6D3-49E1-A48C-000000000001')` [name: 'CK_Address_Valid']
191
191
  }
192
192
  }
@@ -197,14 +197,14 @@ Table "dbo"."AddressInfo2" {
197
197
  "A3" uniqueidentifier(16) [not null]
198
198
  "A4" uniqueidentifier(16) [not null]
199
199
 
200
- Constraints {
200
+ Checks {
201
201
  `([A1]='333' OR [A1]='2222' OR [A1]='1111') AND ([A2]='2222' OR [A2]='1111') AND ([A3]='1111' OR [A3]='2222') AND ([A4]='3333' OR [A4]='2222')` [name: 'CK_Address_Valid2']
202
202
  }
203
203
  }
204
204
 
205
205
  Table "dbo"."TestDescriptionTable" {
206
206
  "Id" int(10) [note: 'Primary key identifier.']
207
- "Name" nvarchar(100) [constraint: `len([Name])>(6)`, note: 'Name of the entity.']
207
+ "Name" nvarchar(100) [check: `len([Name])>(6)`, note: 'Name of the entity.']
208
208
  Note: 'This is the custom comment name on table.'
209
209
  }
210
210
 
@@ -136,11 +136,11 @@ Table "orders" {
136
136
  Table "products" {
137
137
  "id" "int unsigned" [pk, not null, increment]
138
138
  "price" decimal(10,2) [not null]
139
- "quantity" int [not null, constraint: ``quantity` < 10000`]
140
- "total_value" "decimal(10,2) GENERATED ALWAYS AS ((`price` * `quantity`)) STORED" [constraint: ``total_value` > 0`]
139
+ "quantity" int [not null, check: ``quantity` < 10000`]
140
+ "total_value" "decimal(10,2) GENERATED ALWAYS AS ((`price` * `quantity`)) STORED" [check: ``total_value` > 0`]
141
141
  "updated_at" "timestamp on update CURRENT_TIMESTAMP" [default: `CURRENT_TIMESTAMP`]
142
142
 
143
- Constraints {
143
+ Checks {
144
144
  `(`price` > 0) and (`price` < 1000000)` [name: 'products_chk_1']
145
145
  }
146
146
  }
@@ -174,7 +174,7 @@ Table "users" {
174
174
  "last_login" timestamp [default: `CURRENT_TIMESTAMP`]
175
175
  "is_active" tinyint(1) [default: 1]
176
176
 
177
- Constraints {
177
+ Checks {
178
178
  ``created_at` <= `last_login`` [name: 'chk_last_login']
179
179
  }
180
180
  }
@@ -37,12 +37,12 @@ Enum "gender_type" {
37
37
  Table "users" {
38
38
  "user_id" int4 [pk, not null, increment]
39
39
  "username" varchar(50) [unique, not null]
40
- "email" varchar(100) [unique, not null, constraint: `(email)::text ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}$'::text`]
40
+ "email" varchar(100) [unique, not null, check: `(email)::text ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}$'::text`]
41
41
  "password_hash" varchar(255) [not null]
42
42
  "first_name" varchar(50)
43
43
  "last_name" varchar(50)
44
44
  "full_name" varchar(100)
45
- "date_of_birth" date [constraint: `date_of_birth <= (CURRENT_DATE - '13 years'::interval)`]
45
+ "date_of_birth" date [check: `date_of_birth <= (CURRENT_DATE - '13 years'::interval)`]
46
46
  "created_at" timestamptz [default: `CURRENT_TIMESTAMP`]
47
47
  "last_login" timestamptz
48
48
  "is_active" bool [default: true]
@@ -58,14 +58,14 @@ Table "products" {
58
58
  "product_id" int4 [pk, not null, increment]
59
59
  "name" varchar(100) [not null]
60
60
  "description" text
61
- "price" numeric(10,2) [not null, constraint: `price > (0)::numeric`]
62
- "stock_quantity" int4 [not null, constraint: `stock_quantity >= 0`, default: 0]
61
+ "price" numeric(10,2) [not null, check: `price > (0)::numeric`]
62
+ "stock_quantity" int4 [not null, check: `stock_quantity >= 0`, default: 0]
63
63
  "category" varchar(50)
64
64
  "created_at" timestamptz [default: `CURRENT_TIMESTAMP`]
65
65
  "updated_at" timestamptz [default: `CURRENT_TIMESTAMP`]
66
66
  "is_available" bool [default: true]
67
67
 
68
- Constraints {
68
+ Checks {
69
69
  `created_at <= updated_at` [name: 'chk_created_at']
70
70
  }
71
71
 
@@ -78,8 +78,8 @@ Table "orders" {
78
78
  "order_id" int4 [pk, not null, increment]
79
79
  "user_id" int4 [not null]
80
80
  "order_date" timestamptz [default: `CURRENT_TIMESTAMP`]
81
- "total_amount" numeric(12,2) [not null, constraint: `total_amount > (0)::numeric`]
82
- "status" varchar(20) [constraint: `(status)::text = ANY ((ARRAY['pending'::character varying, 'processing'::character varying, 'shipped'::character varying, 'delivered'::character varying, 'cancelled'::character varying])::text[])`, default: 'pending']
81
+ "total_amount" numeric(12,2) [not null, check: `total_amount > (0)::numeric`]
82
+ "status" varchar(20) [check: `(status)::text = ANY ((ARRAY['pending'::character varying, 'processing'::character varying, 'shipped'::character varying, 'delivered'::character varying, 'cancelled'::character varying])::text[])`, default: 'pending']
83
83
  "shipping_address" text [not null]
84
84
  "billing_address" text [not null]
85
85
 
@@ -92,8 +92,8 @@ Table "order_items" {
92
92
  "order_item_id" int4 [pk, not null, increment]
93
93
  "order_id" int4 [not null]
94
94
  "product_id" int4 [not null]
95
- "quantity" int4 [not null, constraint: `quantity > 0`]
96
- "unit_price" numeric(10,2) [not null, constraint: `unit_price > (0)::numeric`]
95
+ "quantity" int4 [not null, check: `quantity > 0`]
96
+ "unit_price" numeric(10,2) [not null, check: `unit_price > (0)::numeric`]
97
97
 
98
98
  Indexes {
99
99
  (order_id, product_id) [type: btree, name: "uq_order_product"]
@@ -134,8 +134,8 @@ Table "user_define_data_types" {
134
134
  "name" varchar(50)
135
135
  "gender" gender_type
136
136
  "age" int4range
137
- "height" float8 [constraint: `height > (0)::double precision`]
138
- "weight" float8 [constraint: `weight > (0)::double precision`]
137
+ "height" float8 [check: `height > (0)::double precision`]
138
+ "weight" float8 [check: `weight > (0)::double precision`]
139
139
  }
140
140
 
141
141
  Table "table_with_comments" {
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2025-10-28T04:24:47.801Z
3
+ -- Generated at: 2025-10-28T05:18:29.035Z
4
4
 
5
5
  CREATE TABLE `orders` (
6
6
  `id` int PRIMARY KEY AUTO_INCREMENT,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2025-10-28T04:24:49.354Z
3
+ -- Generated at: 2025-10-28T05:18:30.595Z
4
4
 
5
5
  CREATE TABLE "orders" (
6
6
  "id" int GENERATED AS IDENTITY PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2025-10-28T04:24:50.839Z
3
+ -- Generated at: 2025-10-28T05:18:32.123Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2025-10-28T04:24:51.575Z
3
+ -- Generated at: 2025-10-28T05:18:32.896Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2025-10-28T04:24:53.954Z
3
+ -- Generated at: 2025-10-28T05:18:35.252Z
4
4
 
5
5
  CREATE TABLE `staff` (
6
6
  `id` int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2025-10-28T04:24:55.497Z
3
+ -- Generated at: 2025-10-28T05:18:36.826Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2025-10-28T04:24:57.018Z
3
+ -- Generated at: 2025-10-28T05:18:38.323Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2025-10-28T04:24:57.775Z
3
+ -- Generated at: 2025-10-28T05:18:39.134Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: SQL Server
3
- -- Generated at: 2025-10-28T04:25:00.237Z
3
+ -- Generated at: 2025-10-28T05:18:41.447Z
4
4
 
5
5
  CREATE SCHEMA [schemaB]
6
6
  GO
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2025-10-28T04:25:01.013Z
3
+ -- Generated at: 2025-10-28T05:18:42.188Z
4
4
 
5
5
  CREATE SCHEMA `schemaB`;
6
6
 
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2025-10-28T04:25:01.787Z
3
+ -- Generated at: 2025-10-28T05:18:42.904Z
4
4
 
5
5
  CREATE USER "C##test01"
6
6
  NO AUTHENTICATION
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2025-10-28T04:25:02.594Z
3
+ -- Generated at: 2025-10-28T05:18:43.626Z
4
4
 
5
5
  CREATE SCHEMA "schemaB";
6
6
 
@@ -340,3 +340,6 @@ undefined
340
340
  2025-10-28T04:25:03.413Z
341
341
  undefined
342
342
 
343
+ 2025-10-28T05:18:44.420Z
344
+ undefined
345
+
@@ -337,3 +337,6 @@ undefined
337
337
  2025-10-28T04:25:27.792Z
338
338
  undefined
339
339
 
340
+ 2025-10-28T05:19:08.458Z
341
+ undefined
342
+
@@ -337,3 +337,6 @@ undefined
337
337
  2025-10-28T04:25:28.864Z
338
338
  undefined
339
339
 
340
+ 2025-10-28T05:19:09.511Z
341
+ undefined
342
+
@@ -334,3 +334,6 @@ undefined
334
334
  2025-10-28T04:25:29.811Z
335
335
  undefined
336
336
 
337
+ 2025-10-28T05:19:10.446Z
338
+ undefined
339
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/cli",
3
- "version": "5.0.0-alpha.0",
3
+ "version": "5.0.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "license": "Apache-2.0",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@babel/cli": "^7.21.0",
29
- "@dbml/connector": "^5.0.0-alpha.0",
30
- "@dbml/core": "^5.0.0-alpha.0",
29
+ "@dbml/connector": "^5.0.0",
30
+ "@dbml/core": "^5.0.0",
31
31
  "bluebird": "^3.5.5",
32
32
  "chalk": "^2.4.2",
33
33
  "commander": "^2.20.0",
@@ -55,7 +55,7 @@
55
55
  "^.+\\.js$": "babel-jest"
56
56
  }
57
57
  },
58
- "gitHead": "630548187910efa893579e80ab07f447df1ef61e",
58
+ "gitHead": "a2d029e9c3c78ab0956312495165ec3115b5bc00",
59
59
  "engines": {
60
60
  "node": ">=18"
61
61
  }