@dbml/cli 3.8.1 → 3.9.1

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.
@@ -504,3 +504,78 @@ Error: TypeError: Cannot read properties of undefined (reading 'map')
504
504
  at Module._load (node:internal/modules/cjs/loader:960:12)
505
505
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
506
506
 
507
+ 2024-09-17T09:47:11.077Z
508
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
509
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
510
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
511
+ at Object.onceWrapper (node:events:629:26)
512
+ at Connection.emit (node:events:514:28)
513
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
514
+ at Connection.socketError (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
515
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
516
+ at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
517
+
518
+ 2024-09-17T09:48:11.126Z
519
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
520
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
521
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
522
+ at Object.onceWrapper (node:events:629:26)
523
+ at Connection.emit (node:events:514:28)
524
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
525
+ at Connection.socketError (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
526
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
527
+ at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
528
+
529
+ 2024-09-17T09:55:00.973Z
530
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
531
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
532
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
533
+ at Object.onceWrapper (node:events:629:26)
534
+ at Connection.emit (node:events:514:28)
535
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
536
+ at Connection.socketError (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
537
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
538
+ at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
539
+
540
+ 2024-09-17T10:02:34.883Z
541
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
542
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
543
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
544
+ at Object.onceWrapper (node:events:629:26)
545
+ at Connection.emit (node:events:514:28)
546
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
547
+ at Connection.socketError (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
548
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
549
+ at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
550
+
551
+ 2024-09-17T10:13:24.584Z
552
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
553
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
554
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
555
+ at Object.onceWrapper (node:events:629:26)
556
+ at Connection.emit (node:events:514:28)
557
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
558
+ at Connection.socketError (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
559
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
560
+ at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
561
+
562
+ 2024-09-18T03:57:41.668Z
563
+ ConnectionError: Login failed for user 'sa'.
564
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
565
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
566
+ at Object.onceWrapper (node:events:629:26)
567
+ at Connection.emit (node:events:514:28)
568
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
569
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:2363:18
570
+ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
571
+
572
+ 2024-09-19T03:57:47.536Z
573
+ ConnectionError: Login failed for user 'sa'.
574
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
575
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
576
+ at Object.onceWrapper (node:events:635:26)
577
+ at Connection.emit (node:events:520:28)
578
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
579
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:2363:18
580
+ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
581
+
@@ -13,18 +13,18 @@ Enum "dbo"."chk_gender" {
13
13
  }
14
14
 
15
15
  Table "dbo"."Authors" {
16
- "AuthorID" int [pk, not null]
17
- "AuthorName" nvarchar [unique]
18
- "BirthYear" int [unique]
19
- "NationalityID" int [pk, not null]
16
+ "AuthorID" int(10) [pk, not null]
17
+ "AuthorName" nvarchar(100) [unique]
18
+ "BirthYear" int(10) [unique]
19
+ "NationalityID" int(10) [pk, not null]
20
20
  }
21
21
 
22
22
  Table "dbo"."Books" {
23
- "AuthorID" int [pk, not null]
24
- "BookID" int [pk, not null]
25
- "ISBN" nvarchar [unique]
26
- "NationalityID" int
27
- "Title" nvarchar
23
+ "AuthorID" int(10) [pk, not null]
24
+ "BookID" int(10) [pk, not null]
25
+ "ISBN" nvarchar(20) [unique]
26
+ "NationalityID" int(10)
27
+ "Title" nvarchar(200)
28
28
  }
29
29
 
30
30
  Table "dbo"."DatetimeTypes" {
@@ -32,36 +32,49 @@ Table "dbo"."DatetimeTypes" {
32
32
  "DATETIME2Col" datetime2 [default: `sysdatetime()`]
33
33
  "DATETIMECol" datetime [default: `getdate()`]
34
34
  "DATETIMEOFFSETCol" datetimeoffset [default: `sysdatetimeoffset()`]
35
- "ID" int [pk, not null, increment]
35
+ "ID" int(10) [pk, not null, increment]
36
36
  "ROWVERSIONCol" timestamp [not null]
37
37
  "SMALLDATETIMECol" smalldatetime [default: `getdate()`]
38
38
  "TIMECol" time [default: `CONVERT([time],getdate())`]
39
39
  }
40
40
 
41
41
  Table "dbo"."gender_reference" {
42
- "value" nvarchar [pk, not null]
42
+ "value" nvarchar(10) [pk, not null]
43
43
  }
44
44
 
45
45
  Table "dbo"."NumberTypes" {
46
- "BIGINTCol" bigint [default: 0]
46
+ "BIGINTCol" bigint(19) [default: 0]
47
47
  "BITCol" bit [default: 0]
48
48
  "DECIMALCol" decimal(10,2) [default: 0.00]
49
- "FLOATCol" float [default: 0.0]
50
- "ID" int [pk, not null, increment]
51
- "INTCol" int [default: 0]
49
+ "FLOATCol" float(53) [default: 0.0]
50
+ "ID" int(10) [pk, not null, increment]
51
+ "INTCol" int(10) [default: 0]
52
52
  "NUMERICCol" numeric(10,2) [default: 0.00]
53
- "REALCol" real [default: 0.0]
54
- "SMALLINTCol" smallint [default: 0]
55
- "TINYINTCol" tinyint [default: 0]
53
+ "REALCol" real(24) [default: 0.0]
54
+ "SMALLINTCol" smallint(5) [default: 0]
55
+ "TINYINTCol" tinyint(3) [default: 0]
56
+ }
57
+
58
+ Table "dbo"."NumberTypesNoDefault" {
59
+ "BIGINTCol" bigint(19)
60
+ "BITCol" bit
61
+ "DECIMALCol" decimal(10,2)
62
+ "FLOATCol" float(53)
63
+ "ID" int(10) [pk, not null, increment]
64
+ "INTCol" int(10)
65
+ "NUMERICCol" numeric(10,2)
66
+ "REALCol" real(24)
67
+ "SMALLINTCol" smallint(5)
68
+ "TINYINTCol" tinyint(3)
56
69
  }
57
70
 
58
71
  Table "dbo"."ObjectTypes" {
59
- "BinaryField" binary [default: `0x00`]
60
- "Id" int [pk, not null, increment]
72
+ "BinaryField" binary(50) [default: `0x00`]
73
+ "Id" int(10) [pk, not null, increment]
61
74
  "ImageField" image [default: `0x00`]
62
- "JsonField" nvarchar [default: `N'{"defaultKey": "defaultValue", "status": "active", "count": 0}'`]
63
- "VarBinaryField" varbinary [default: `0x00`]
64
- "VarBinaryMaxField" varbinary [default: `0x00`]
75
+ "JsonField" nvarchar(MAX) [default: `N'{"defaultKey": "defaultValue", "status": "active", "count": 0}'`]
76
+ "VarBinaryField" varbinary(50) [default: `0x00`]
77
+ "VarBinaryMaxField" varbinary(MAX) [default: `0x00`]
65
78
  "XmlField" xml [default: '''<Books>
66
79
  <Book>
67
80
  <Title>The Great Gatsby</Title>
@@ -87,11 +100,11 @@ Table "dbo"."ObjectTypes" {
87
100
  }
88
101
 
89
102
  Table "dbo"."order_items" {
90
- "order_id" int [unique, not null]
91
- "order_item_id" int [pk, not null, increment]
92
- "product_id" int [unique, not null]
93
- "quantity" int [not null]
94
- "unit_price" decimal [not null]
103
+ "order_id" int(10) [unique, not null]
104
+ "order_item_id" int(10) [pk, not null, increment]
105
+ "product_id" int(10) [unique, not null]
106
+ "quantity" int(10) [not null]
107
+ "unit_price" decimal(10,2) [not null]
95
108
 
96
109
  Indexes {
97
110
  (order_id, product_id) [type: nonclustered, name: "idx_order_items_order_product"]
@@ -101,11 +114,11 @@ Table "dbo"."order_items" {
101
114
  Table "dbo"."orders" {
102
115
  "billing_address" text [not null]
103
116
  "order_date" datetime2 [default: `getdate()`]
104
- "order_id" int [pk, not null, increment]
117
+ "order_id" int(10) [pk, not null, increment]
105
118
  "shipping_address" text [not null]
106
119
  "status" dbo.chk_status [default: 'pending']
107
- "total_amount" decimal [not null]
108
- "user_id" int [not null]
120
+ "total_amount" decimal(12,2) [not null]
121
+ "user_id" int(10) [not null]
109
122
 
110
123
  Indexes {
111
124
  (user_id, order_date) [type: nonclustered, name: "idx_orders_user_date"]
@@ -113,14 +126,14 @@ Table "dbo"."orders" {
113
126
  }
114
127
 
115
128
  Table "dbo"."products" {
116
- "category" varchar
129
+ "category" varchar(50)
117
130
  "created_at" datetime2 [default: `getdate()`]
118
131
  "description" text
119
132
  "is_available" bit [default: 1]
120
- "name" varchar [not null]
121
- "price" decimal [not null]
122
- "product_id" int [pk, not null, increment]
123
- "stock_quantity" int [not null, default: 0]
133
+ "name" varchar(100) [not null]
134
+ "price" decimal(10,2) [not null]
135
+ "product_id" int(10) [pk, not null, increment]
136
+ "stock_quantity" int(10) [not null, default: 0]
124
137
  "updated_at" datetime2 [default: `getdate()`]
125
138
 
126
139
  Indexes {
@@ -130,47 +143,47 @@ Table "dbo"."products" {
130
143
 
131
144
  Table "dbo"."StringTypes" {
132
145
  "CharField" char(10) [default: 'N/A']
133
- "Id" int [pk, not null, increment]
134
- "NCharField" nchar [default: `N'N/A'`]
146
+ "Id" int(10) [pk, not null, increment]
147
+ "NCharField" nchar(10) [default: `N'N/A'`]
135
148
  "NTextField" ntext [default: `N'N/A'`]
136
- "NVarCharField" nvarchar [default: `N'N/A'`]
137
- "NVarCharMaxField" nvarchar [default: `N'N/A'`]
138
- "TextField" text(16) [default: 'N/A']
149
+ "NVarCharField" nvarchar(50) [default: `N'N/A'`]
150
+ "NVarCharMaxField" nvarchar(MAX) [default: `N'N/A'`]
151
+ "TextField" text [default: 'N/A']
139
152
  "VarcharField" varchar(50) [default: '{"default_key": "default_value"}']
140
- "VarcharMaxField" varchar [default: 'N/A']
153
+ "VarcharMaxField" varchar(MAX) [default: 'N/A']
141
154
  }
142
155
 
143
156
  Table "dbo"."table_with_comments" {
144
157
  "created_at" datetime2 [default: `getdate()`, note: 'Timestamp when the item was created.']
145
- "description" text [note: 'Detailed description of the item.']
146
- "id" int [pk, not null, increment, note: 'Unique identifier for each item.']
147
- "name" varchar [note: 'Name of the item.']
158
+ "description" text [note: '''Item\'s description''']
159
+ "id" int(10) [pk, not null, increment, note: 'Unique identifier for each item.']
160
+ "name" varchar(100) [note: 'Name of the item.']
148
161
  Note: 'This table stores information about various items.'
149
162
  }
150
163
 
151
164
  Table "dbo"."user_define_data_types" {
152
- "age_end" int
153
- "age_start" int
165
+ "age_end" int(10)
166
+ "age_start" int(10)
154
167
  "gender" dbo.chk_gender
155
- "height" float
156
- "id" int [pk, not null, increment]
157
- "name" nvarchar
158
- "weight" float
168
+ "height" float(53)
169
+ "id" int(10) [pk, not null, increment]
170
+ "name" nvarchar(50)
171
+ "weight" float(53)
159
172
  }
160
173
 
161
174
  Table "dbo"."users" {
162
175
  "created_at" datetime2 [default: `getdate()`]
163
176
  "date_of_birth" date
164
- "email" varchar [unique, not null]
165
- "first_name" varchar
166
- "full_name" varchar
167
- "full_name_lower" varchar
177
+ "email" varchar(100) [unique, not null]
178
+ "first_name" varchar(50)
179
+ "full_name" varchar(100)
180
+ "full_name_lower" varchar(100)
168
181
  "is_active" bit [default: 1]
169
182
  "last_login" datetime2
170
- "last_name" varchar
171
- "password_hash" varchar [not null]
172
- "user_id" int [pk, not null, increment]
173
- "username" varchar [unique, not null]
183
+ "last_name" varchar(50)
184
+ "password_hash" varchar(255) [not null]
185
+ "user_id" int(10) [pk, not null, increment]
186
+ "username" varchar(50) [unique, not null]
174
187
 
175
188
  Indexes {
176
189
  email [type: nonclustered, name: "idx_users_email"]
@@ -0,0 +1,205 @@
1
+ Enum "dbo"."chk_status" {
2
+ "cancelled"
3
+ "delivered"
4
+ "shipped"
5
+ "processing"
6
+ "pending"
7
+ }
8
+
9
+ Enum "dbo"."chk_gender" {
10
+ "Other"
11
+ "Female"
12
+ "Male"
13
+ }
14
+
15
+ Table "dbo"."Authors" {
16
+ "AuthorID" int(10) [pk, not null]
17
+ "AuthorName" nvarchar(100) [unique]
18
+ "BirthYear" int(10) [unique]
19
+ "NationalityID" int(10) [pk, not null]
20
+ }
21
+
22
+ Table "dbo"."Books" {
23
+ "AuthorID" int(10) [pk, not null]
24
+ "BookID" int(10) [pk, not null]
25
+ "ISBN" nvarchar(20) [unique]
26
+ "NationalityID" int(10)
27
+ "Title" nvarchar(200)
28
+ }
29
+
30
+ Table "dbo"."DatetimeTypes" {
31
+ "DATECol" date [default: `getdate()`]
32
+ "DATETIME2Col" datetime2(7) [default: `sysdatetime()`]
33
+ "DATETIME2Col_2" datetime2(4) [default: `sysdatetime()`]
34
+ "DATETIMECol" datetime [default: `getdate()`]
35
+ "DATETIMEOFFSETCol" datetimeoffset(7) [default: `sysdatetimeoffset()`]
36
+ "DATETIMEOFFSETCol_2" datetimeoffset(4) [default: `sysdatetimeoffset()`]
37
+ "ID" int(10) [pk, not null, increment]
38
+ "ROWVERSIONCol" timestamp [not null]
39
+ "SMALLDATETIMECol" smalldatetime [default: `getdate()`]
40
+ "TIMECol" time [default: `CONVERT([time],getdate())`]
41
+ }
42
+
43
+ Table "dbo"."gender_reference" {
44
+ "value" nvarchar(10) [pk, not null]
45
+ }
46
+
47
+ Table "dbo"."NumberTypes" {
48
+ "BIGINTCol" bigint(19) [default: 0]
49
+ "BITCol" bit [default: 0]
50
+ "DECIMALCol" decimal(10,2) [default: 0.00]
51
+ "FLOATCol" float(53) [default: 0.0]
52
+ "ID" int(10) [pk, not null, increment]
53
+ "INTCol" int(10) [default: 0]
54
+ "NUMERICCol" numeric(10,2) [default: 0.00]
55
+ "REALCol" real(24) [default: 0.0]
56
+ "SMALLINTCol" smallint(5) [default: 0]
57
+ "TINYINTCol" tinyint(3) [default: 0]
58
+ }
59
+
60
+ Table "dbo"."NumberTypesNoDefault" {
61
+ "BIGINTCol" bigint(19)
62
+ "BITCol" bit
63
+ "DECIMALCol" decimal(10,2)
64
+ "FLOATCol" float(53)
65
+ "ID" int(10) [pk, not null, increment]
66
+ "INTCol" int(10)
67
+ "NUMERICCol" numeric(10,2)
68
+ "REALCol" real(24)
69
+ "SMALLINTCol" smallint(5)
70
+ "TINYINTCol" tinyint(3)
71
+ }
72
+
73
+ Table "dbo"."ObjectTypes" {
74
+ "BinaryField" binary(50) [default: `0x00`]
75
+ "Id" int(10) [pk, not null, increment]
76
+ "ImageField" image [default: `0x00`]
77
+ "JsonField" nvarchar(MAX) [default: `N'{"defaultKey": "defaultValue", "status": "active", "count": 0}'`]
78
+ "VarBinaryField" varbinary(50) [default: `0x00`]
79
+ "VarBinaryMaxField" varbinary(MAX) [default: `0x00`]
80
+ "XmlField" xml [default: '''<Books>
81
+ <Book>
82
+ <Title>The Great Gatsby</Title>
83
+ <Author>F. Scott Fitzgerald</Author>
84
+ <Year>1925</Year>
85
+ <Price>10.99</Price>
86
+ <Publisher>Scribner</Publisher>
87
+ <Location>New York</Location>
88
+ <Genre>Fiction</Genre>
89
+ <Subgenre>Classic</Subgenre>
90
+ </Book>
91
+ <Book>
92
+ <Title>1984</Title>
93
+ <Author>George Orwell</Author>
94
+ <Year>1949</Year>
95
+ <Price>8.99</Price>
96
+ <Publisher>Secker & Warburg</Publisher>
97
+ <Location>London</Location>
98
+ <Genre>Dystopian</Genre>
99
+ <Subgenre>Political Fiction</Subgenre>
100
+ </Book>
101
+ </Books>''']
102
+ }
103
+
104
+ Table "dbo"."order_items" {
105
+ "order_id" int(10) [unique, not null]
106
+ "order_item_id" int(10) [pk, not null, increment]
107
+ "product_id" int(10) [unique, not null]
108
+ "quantity" int(10) [not null]
109
+ "unit_price" decimal(10,2) [not null]
110
+
111
+ Indexes {
112
+ (order_id, product_id) [type: nonclustered, name: "idx_order_items_order_product"]
113
+ }
114
+ }
115
+
116
+ Table "dbo"."orders" {
117
+ "billing_address" text [not null]
118
+ "order_date" datetime2(7) [default: `getdate()`]
119
+ "order_id" int(10) [pk, not null, increment]
120
+ "shipping_address" text [not null]
121
+ "status" dbo.chk_status [default: 'pending']
122
+ "total_amount" decimal(12,2) [not null]
123
+ "user_id" int(10) [not null]
124
+
125
+ Indexes {
126
+ (user_id, order_date) [type: nonclustered, name: "idx_orders_user_date"]
127
+ }
128
+ }
129
+
130
+ Table "dbo"."products" {
131
+ "category" varchar(50)
132
+ "created_at" datetime2(7) [default: `getdate()`]
133
+ "description" text
134
+ "is_available" bit [default: 1]
135
+ "name" varchar(100) [not null]
136
+ "price" decimal(10,2) [not null]
137
+ "product_id" int(10) [pk, not null, increment]
138
+ "stock_quantity" int(10) [not null, default: 0]
139
+ "updated_at" datetime2(7) [default: `getdate()`]
140
+
141
+ Indexes {
142
+ category [type: nonclustered, name: "idx_products_category"]
143
+ }
144
+ }
145
+
146
+ Table "dbo"."StringTypes" {
147
+ "CharField" char(10) [default: 'N/A']
148
+ "Id" int(10) [pk, not null, increment]
149
+ "NCharField" nchar(10) [default: `N'N/A'`]
150
+ "NTextField" ntext [default: `N'N/A'`]
151
+ "NVarCharField" nvarchar(50) [default: `N'N/A'`]
152
+ "NVarCharMaxField" nvarchar(MAX) [default: `N'N/A'`]
153
+ "TextField" text [default: 'N/A']
154
+ "VarcharField" varchar(50) [default: '{"default_key": "default_value"}']
155
+ "VarcharMaxField" varchar(MAX) [default: 'N/A']
156
+ }
157
+
158
+ Table "dbo"."table_with_comments" {
159
+ "created_at" datetime2(7) [default: `getdate()`, note: 'Timestamp when the item was created.']
160
+ "description" text [note: '''Item\'s description''']
161
+ "id" int(10) [pk, not null, increment, note: 'Unique identifier for each item.']
162
+ "name" varchar(100) [note: 'Name of the item.']
163
+ Note: 'This table stores information about various items.'
164
+ }
165
+
166
+ Table "dbo"."user_define_data_types" {
167
+ "age_end" int(10)
168
+ "age_start" int(10)
169
+ "gender" dbo.chk_gender
170
+ "height" float(53)
171
+ "id" int(10) [pk, not null, increment]
172
+ "name" nvarchar(50)
173
+ "weight" float(53)
174
+ }
175
+
176
+ Table "dbo"."users" {
177
+ "created_at" datetime2(7) [default: `getdate()`]
178
+ "date_of_birth" date
179
+ "email" varchar(100) [unique, not null]
180
+ "first_name" varchar(50)
181
+ "full_name" varchar(100)
182
+ "full_name_lower" varchar(100)
183
+ "is_active" bit [default: 1]
184
+ "last_login" datetime2(7)
185
+ "last_name" varchar(50)
186
+ "password_hash" varchar(255) [not null]
187
+ "user_id" int(10) [pk, not null, increment]
188
+ "username" varchar(50) [unique, not null]
189
+
190
+ Indexes {
191
+ email [type: nonclustered, name: "idx_users_email"]
192
+ full_name [type: nonclustered, name: "idx_users_full_name"]
193
+ (is_active, full_name_lower) [type: nonclustered, name: "idx_users_is_active_full_name"]
194
+ }
195
+ }
196
+
197
+ Ref "FK_AuthorNationality":"dbo"."Authors".("AuthorID", "NationalityID") < "dbo"."Books".("AuthorID", "NationalityID")
198
+
199
+ Ref "fk_product":"dbo"."products"."product_id" < "dbo"."order_items"."product_id" [update: cascade]
200
+
201
+ Ref "fk_order":"dbo"."orders"."order_id" < "dbo"."order_items"."order_id" [update: cascade, delete: cascade]
202
+
203
+ Ref "fk_user":"dbo"."users"."user_id" < "dbo"."orders"."user_id" [update: cascade, delete: cascade]
204
+
205
+ Ref "fk_gender":"dbo"."gender_reference"."value" < "dbo"."user_define_data_types"."gender"
@@ -132,6 +132,20 @@ CREATE TABLE NumberTypes (
132
132
  );
133
133
  GO
134
134
 
135
+ CREATE TABLE NumberTypesNoDefault (
136
+ ID INT IDENTITY(1,1) PRIMARY KEY,
137
+ TINYINTCol TINYINT,
138
+ SMALLINTCol SMALLINT,
139
+ INTCol INT,
140
+ BIGINTCol BIGINT,
141
+ DECIMALCol DECIMAL(10, 2),
142
+ NUMERICCol NUMERIC(10, 2),
143
+ FLOATCol FLOAT,
144
+ REALCol REAL,
145
+ BITCol BIT
146
+ );
147
+ GO
148
+
135
149
  -- Create a table with default values for date and time types
136
150
  CREATE TABLE DatetimeTypes (
137
151
  ID INT IDENTITY(1,1) PRIMARY KEY,
@@ -251,7 +265,7 @@ GO
251
265
 
252
266
  EXEC sys.sp_addextendedproperty
253
267
  @name=N'MS_Description',
254
- @value=N'Detailed description of the item.',
268
+ @value=N'Item''s description',
255
269
  @level0type=N'SCHEMA',
256
270
  @level0name=N'dbo',
257
271
  @level1type=N'TABLE',
@@ -318,3 +318,84 @@ Error: TypeError: Cannot read properties of undefined (reading 'map')
318
318
  at Module._load (node:internal/modules/cjs/loader:960:12)
319
319
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
320
320
 
321
+ 2024-09-19T03:57:47.937Z
322
+ undefined
323
+
324
+ 2024-10-10T09:34:04.641Z
325
+ Error: connect ECONNREFUSED ::1:3306
326
+ at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:253:31)
327
+ at connectMySQL (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:8:57)
328
+ at fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:366:26)
329
+ at Object.fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:16:57)
330
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
331
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:62:26)
332
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
333
+ at Module._compile (node:internal/modules/cjs/loader:1256:14)
334
+ at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
335
+ at Module.load (node:internal/modules/cjs/loader:1119:32)
336
+
337
+ 2024-10-10T09:38:06.539Z
338
+ Error: connect ECONNREFUSED ::1:3306
339
+ at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:253:31)
340
+ at connectMySQL (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:8:57)
341
+ at fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:366:26)
342
+ at Object.fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:16:57)
343
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
344
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:62:26)
345
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
346
+ at Module._compile (node:internal/modules/cjs/loader:1256:14)
347
+ at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
348
+ at Module.load (node:internal/modules/cjs/loader:1119:32)
349
+
350
+ 2024-10-10T09:39:26.496Z
351
+ Error: connect ECONNREFUSED ::1:3306
352
+ at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:253:31)
353
+ at connectMySQL (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:8:57)
354
+ at fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:366:26)
355
+ at Object.fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:16:57)
356
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
357
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:62:26)
358
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
359
+ at Module._compile (node:internal/modules/cjs/loader:1256:14)
360
+ at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
361
+ at Module.load (node:internal/modules/cjs/loader:1119:32)
362
+
363
+ 2024-10-10T09:43:10.585Z
364
+ Error: connect ECONNREFUSED ::1:3306
365
+ at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:253:31)
366
+ at connectMySQL (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:8:57)
367
+ at fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:366:26)
368
+ at Object.fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:16:57)
369
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
370
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:62:26)
371
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
372
+ at Module._compile (node:internal/modules/cjs/loader:1256:14)
373
+ at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
374
+ at Module.load (node:internal/modules/cjs/loader:1119:32)
375
+
376
+ 2024-10-10T09:43:40.861Z
377
+ Error: connect ECONNREFUSED ::1:3306
378
+ at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:253:31)
379
+ at connectMySQL (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:8:57)
380
+ at fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:366:26)
381
+ at Object.fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:16:57)
382
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
383
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:62:26)
384
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
385
+ at Module._compile (node:internal/modules/cjs/loader:1256:14)
386
+ at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
387
+ at Module.load (node:internal/modules/cjs/loader:1119:32)
388
+
389
+ 2024-10-11T08:36:12.009Z
390
+ Error: connect ECONNREFUSED ::1:3306
391
+ at createConnection (/Users/huylm/code/dbx/dbml/node_modules/mysql2/promise.js:253:31)
392
+ at connectMySQL (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:8:57)
393
+ at fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/mysqlConnector.js:366:26)
394
+ at Object.fetchSchemaJson (/Users/huylm/code/dbx/dbml/packages/dbml-connector/dist/connectors/connector.js:16:57)
395
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:24:51)
396
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:62:26)
397
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
398
+ at Module._compile (node:internal/modules/cjs/loader:1256:14)
399
+ at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
400
+ at Module.load (node:internal/modules/cjs/loader:1119:32)
401
+
@@ -98,8 +98,8 @@ Table "default_example" {
98
98
 
99
99
  Table "hash_index_example" {
100
100
  "id" int [pk, not null, note: 'unique identifier for each record']
101
- "name" varchar(100) [note: 'first name of the individual']
102
- "name1" varchar(100) [note: 'last name of the individual']
101
+ "name" varchar(100) [note: '''first name\'s of the individual''']
102
+ "name1" varchar(100) [note: '''last name\'s of the individual''']
103
103
 
104
104
  Indexes {
105
105
  (name, name1) [type: hash, name: "idx_name_name1"]
@@ -98,8 +98,8 @@ Table "default_example" {
98
98
 
99
99
  Table "hash_index_example" {
100
100
  "id" int [pk, not null, note: 'unique identifier for each record']
101
- "name" varchar(100) [note: 'first name of the individual']
102
- "name1" varchar(100) [note: 'last name of the individual']
101
+ "name" varchar(100) [note: '''first name\'s of the individual''']
102
+ "name1" varchar(100) [note: '''last name\'s of the individual''']
103
103
 
104
104
  Indexes {
105
105
  (name, name1) [type: hash, name: "idx_name_name1"]
@@ -124,8 +124,8 @@ create unique index idx_email_unique on index_example (email);
124
124
  -- comments & hash index
125
125
  create table hash_index_example (
126
126
  id int primary key comment 'unique identifier for each record',
127
- name varchar(100) comment 'first name of the individual',
128
- name1 varchar(100) comment 'last name of the individual',
127
+ name varchar(100) comment 'first name''s of the individual',
128
+ name1 varchar(100) comment 'last name''s of the individual',
129
129
  index idx_name_name1 (name, name1) using hash comment 'hash index for fast lookups on name and name1'
130
130
  ) engine=memory comment='table for storing names with a hash index';
131
131
 
@@ -136,10 +136,10 @@ Table "table2" {
136
136
 
137
137
  Table "table_with_comments" {
138
138
  "id" int4 [pk, not null, increment, note: 'Unique identifier for each item.']
139
- "name" varchar(100) [note: 'Name of the item.']
140
- "description" text [note: 'Detailed description of the item.']
139
+ "name" varchar(100) [note: '''Item\'s name.''']
140
+ "description" text [note: '''Item\'s description''']
141
141
  "created_at" timestamptz [default: `CURRENT_TIMESTAMP`, note: 'Timestamp when the item was created.']
142
- Note: 'This table stores information about various items.'
142
+ Note: '''This table stores information about various items. Such as: \'id\', \'name\', \'description\''''
143
143
  }
144
144
 
145
145
  Table "user_define_data_types" {
@@ -1,3 +1,33 @@
1
+ Enum "dbml_test"."enum_type1" {
2
+ "value1"
3
+ "value2"
4
+ }
5
+
6
+ Enum "dbml_test"."enum_type3" {
7
+ "value4"
8
+ "value5"
9
+ }
10
+
11
+ Table "dbml_test"."table1" {
12
+ "id" int4 [pk, not null, increment]
13
+ "status" dbml_test.enum_type1
14
+ }
15
+
16
+ Table "dbml_test"."table3" {
17
+ "id" int4 [pk, not null, increment]
18
+ "status" dbml_test.enum_type3
19
+ }
20
+
21
+ Enum "enum_type1" {
22
+ "value1"
23
+ "value2"
24
+ }
25
+
26
+ Enum "enum_type2" {
27
+ "value1"
28
+ "value3"
29
+ }
30
+
1
31
  Enum "gender_type" {
2
32
  "Male"
3
33
  "Female"
@@ -94,12 +124,22 @@ Table "products" {
94
124
  }
95
125
  }
96
126
 
127
+ Table "table1" {
128
+ "id" int4 [pk, not null, increment]
129
+ "status" enum_type1
130
+ }
131
+
132
+ Table "table2" {
133
+ "id" int4 [pk, not null, increment]
134
+ "status" enum_type2
135
+ }
136
+
97
137
  Table "table_with_comments" {
98
138
  "id" int4 [pk, not null, increment, note: 'Unique identifier for each item.']
99
- "name" varchar(100) [note: 'Name of the item.']
100
- "description" text [note: 'Detailed description of the item.']
139
+ "name" varchar(100) [note: '''Item\'s name.''']
140
+ "description" text [note: '''Item\'s description''']
101
141
  "created_at" timestamptz [default: `CURRENT_TIMESTAMP`, note: 'Timestamp when the item was created.']
102
- Note: 'This table stores information about various items.'
142
+ Note: '''This table stores information about various items. Such as: \'id\', \'name\', \'description\''''
103
143
  }
104
144
 
105
145
  Table "user_define_data_types" {
@@ -138,3 +178,8 @@ Ref "fk_order":"orders"."order_id" < "order_items"."order_id" [delete: cascade]
138
178
  Ref "fk_product":"products"."product_id" < "order_items"."product_id" [delete: cascade]
139
179
 
140
180
  Ref "fk_user":"users"."user_id" < "orders"."user_id" [delete: cascade]
181
+
182
+ Table "test"."employee" {
183
+ "employeeid" int8 [not null]
184
+ "identifier" test.test.citext
185
+ }
@@ -130,10 +130,10 @@ CREATE TABLE table_with_comments (
130
130
  );
131
131
 
132
132
  -- Add comments
133
- COMMENT ON TABLE table_with_comments IS 'This table stores information about various items.';
133
+ COMMENT ON TABLE table_with_comments IS 'This table stores information about various items. Such as: ''id'', ''name'', ''description''';
134
134
  COMMENT ON COLUMN table_with_comments.id IS 'Unique identifier for each item.';
135
- COMMENT ON COLUMN table_with_comments.name IS 'Name of the item.';
136
- COMMENT ON COLUMN table_with_comments.description IS 'Detailed description of the item.';
135
+ COMMENT ON COLUMN table_with_comments.name IS 'Item''s name.';
136
+ COMMENT ON COLUMN table_with_comments.description IS 'Item''s description';
137
137
  COMMENT ON COLUMN table_with_comments.created_at IS 'Timestamp when the item was created.';
138
138
 
139
139
  -- Create Authors table
package/dbml-error.log CHANGED
@@ -139,3 +139,63 @@ Error: Test throw
139
139
  at Module.load (node:internal/modules/cjs/loader:1119:32)
140
140
  at Module._load (node:internal/modules/cjs/loader:960:12)
141
141
 
142
+ 2024-09-17T09:27:49.220Z
143
+ ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
144
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
145
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
146
+ at Object.onceWrapper (node:events:629:26)
147
+ at Connection.emit (node:events:514:28)
148
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
149
+ at Connection.socketError (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1351:12)
150
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:1144:14
151
+ at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
152
+
153
+ 2024-10-10T09:44:57.755Z
154
+ ConnectionError: Login failed for user 'sa'.
155
+ at /Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
156
+ at Connection.onConnect (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:849:9)
157
+ at Object.onceWrapper (node:events:629:26)
158
+ at Connection.emit (node:events:514:28)
159
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
160
+ at /Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:2363:18
161
+ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
162
+
163
+ 2024-10-10T09:45:34.357Z
164
+ RequestError: Incorrect syntax near the keyword 'WHERE'.
165
+ at handleError (/Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/request.js:384:15)
166
+ at Connection.emit (node:events:514:28)
167
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
168
+ at RequestTokenHandler.onErrorMessage (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/token/handler.js:284:21)
169
+ at Readable.<anonymous> (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/token/token-stream-parser.js:19:33)
170
+ at Readable.emit (node:events:514:28)
171
+ at addChunk (node:internal/streams/readable:324:12)
172
+ at readableAddChunk (node:internal/streams/readable:297:9)
173
+ at Readable.push (node:internal/streams/readable:234:10)
174
+ at next (node:internal/streams/from:98:31)
175
+
176
+ 2024-10-10T09:46:21.137Z
177
+ RequestError: Incorrect syntax near the keyword 'WHERE'.
178
+ at handleError (/Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/request.js:384:15)
179
+ at Connection.emit (node:events:514:28)
180
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
181
+ at RequestTokenHandler.onErrorMessage (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/token/handler.js:284:21)
182
+ at Readable.<anonymous> (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/token/token-stream-parser.js:19:33)
183
+ at Readable.emit (node:events:514:28)
184
+ at addChunk (node:internal/streams/readable:324:12)
185
+ at readableAddChunk (node:internal/streams/readable:297:9)
186
+ at Readable.push (node:internal/streams/readable:234:10)
187
+ at next (node:internal/streams/from:98:31)
188
+
189
+ 2024-10-10T09:49:37.872Z
190
+ RequestError: Incorrect syntax near the keyword 'WHERE'.
191
+ at handleError (/Users/huylm/code/dbx/dbml/node_modules/mssql/lib/tedious/request.js:384:15)
192
+ at Connection.emit (node:events:514:28)
193
+ at Connection.emit (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/connection.js:970:18)
194
+ at RequestTokenHandler.onErrorMessage (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/token/handler.js:284:21)
195
+ at Readable.<anonymous> (/Users/huylm/code/dbx/dbml/node_modules/tedious/lib/token/token-stream-parser.js:19:33)
196
+ at Readable.emit (node:events:514:28)
197
+ at addChunk (node:internal/streams/readable:324:12)
198
+ at readableAddChunk (node:internal/streams/readable:297:9)
199
+ at Readable.push (node:internal/streams/readable:234:10)
200
+ at next (node:internal/streams/from:98:31)
201
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/cli",
3
- "version": "3.8.1",
3
+ "version": "3.9.1",
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": "^3.8.1",
30
- "@dbml/core": "^3.8.1",
29
+ "@dbml/connector": "^3.9.1",
30
+ "@dbml/core": "^3.9.1",
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": "40a25ded1488372f082739f6d43e45f2ad918e7e",
58
+ "gitHead": "8494c278b97347945cf3b71d6f75cd658dbae85d",
59
59
  "engines": {
60
60
  "node": ">=18"
61
61
  }