@dbml/cli 8.0.0-alpha.8 → 8.0.0-prerelease.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 (94) hide show
  1. package/__tests__/db2dbml/mssql/dbml-error.log +110 -0
  2. package/__tests__/db2dbml/mysql/dbml-error.log +143 -0
  3. package/__tests__/db2dbml/oracle/dbml-error.log +154 -0
  4. package/__tests__/db2dbml/postgres/dbml-error.log +77 -0
  5. package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  6. package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +1 -1
  7. package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  8. package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  9. package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  10. package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +1 -1
  11. package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  12. package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  13. package/__tests__/dbml2sql/multifile aliased import stdout/dbml-error.log +0 -0
  14. package/__tests__/dbml2sql/multifile aliased import stdout/in-files/auth.dbml +4 -0
  15. package/__tests__/dbml2sql/multifile aliased import stdout/in-files/main.dbml +6 -0
  16. package/__tests__/dbml2sql/multifile aliased import stdout/options.json +3 -0
  17. package/__tests__/dbml2sql/multifile aliased import stdout/stdout.txt +12 -0
  18. package/__tests__/dbml2sql/multifile circular import stdout/dbml-error.log +0 -0
  19. package/__tests__/dbml2sql/multifile circular import stdout/in-files/a.dbml +6 -0
  20. package/__tests__/dbml2sql/multifile circular import stdout/in-files/b.dbml +6 -0
  21. package/__tests__/dbml2sql/multifile circular import stdout/options.json +3 -0
  22. package/__tests__/dbml2sql/multifile circular import stdout/stdout.txt +14 -0
  23. package/__tests__/dbml2sql/multifile error entry-syntax-error/dbml-error.log +97 -0
  24. package/__tests__/dbml2sql/multifile error entry-syntax-error/in-files/lib.dbml +4 -0
  25. package/__tests__/dbml2sql/multifile error entry-syntax-error/in-files/main.dbml +6 -0
  26. package/__tests__/dbml2sql/multifile error entry-syntax-error/options.json +3 -0
  27. package/__tests__/dbml2sql/multifile error entry-syntax-error/stdout.txt +5 -0
  28. package/__tests__/dbml2sql/multifile error import-not-found/dbml-error.log +7182 -0
  29. package/__tests__/dbml2sql/multifile error import-not-found/in-files/main.dbml +5 -0
  30. package/__tests__/dbml2sql/multifile error import-not-found/options.json +3 -0
  31. package/__tests__/dbml2sql/multifile error import-not-found/stdout.txt +4 -0
  32. package/__tests__/dbml2sql/multifile error imported-syntax-error/dbml-error.log +28 -0
  33. package/__tests__/dbml2sql/multifile error imported-syntax-error/in-files/broken.dbml +4 -0
  34. package/__tests__/dbml2sql/multifile error imported-syntax-error/in-files/main.dbml +6 -0
  35. package/__tests__/dbml2sql/multifile error imported-syntax-error/options.json +3 -0
  36. package/__tests__/dbml2sql/multifile error imported-syntax-error/stdout.txt +5 -0
  37. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/dbml-error.log +28 -0
  38. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/in-files/base.dbml +6 -0
  39. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/in-files/main.dbml +3 -0
  40. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/in-files/types.dbml +4 -0
  41. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/options.json +3 -0
  42. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/stdout.txt +4 -0
  43. package/__tests__/dbml2sql/multifile records pulling stdout/dbml-error.log +0 -0
  44. package/__tests__/dbml2sql/multifile records pulling stdout/in-files/base.dbml +9 -0
  45. package/__tests__/dbml2sql/multifile records pulling stdout/in-files/main.dbml +6 -0
  46. package/__tests__/dbml2sql/multifile records pulling stdout/options.json +3 -0
  47. package/__tests__/dbml2sql/multifile records pulling stdout/stdout.txt +23 -0
  48. package/__tests__/dbml2sql/multifile refs across files stdout/dbml-error.log +0 -0
  49. package/__tests__/dbml2sql/multifile refs across files stdout/in-files/main.dbml +2 -0
  50. package/__tests__/dbml2sql/multifile refs across files stdout/in-files/orders.dbml +8 -0
  51. package/__tests__/dbml2sql/multifile refs across files stdout/in-files/users.dbml +4 -0
  52. package/__tests__/dbml2sql/multifile refs across files stdout/options.json +3 -0
  53. package/__tests__/dbml2sql/multifile refs across files stdout/stdout.txt +12 -0
  54. package/__tests__/dbml2sql/multifile schema pulling stdout/dbml-error.log +0 -0
  55. package/__tests__/dbml2sql/multifile schema pulling stdout/in-files/auth.dbml +9 -0
  56. package/__tests__/dbml2sql/multifile schema pulling stdout/in-files/main.dbml +3 -0
  57. package/__tests__/dbml2sql/multifile schema pulling stdout/options.json +3 -0
  58. package/__tests__/dbml2sql/multifile schema pulling stdout/stdout.txt +14 -0
  59. package/__tests__/dbml2sql/multifile tablegroup pulling stdout/dbml-error.log +0 -0
  60. package/__tests__/dbml2sql/multifile tablegroup pulling stdout/in-files/base.dbml +14 -0
  61. package/__tests__/dbml2sql/multifile tablegroup pulling stdout/in-files/main.dbml +1 -0
  62. package/__tests__/dbml2sql/multifile tablegroup pulling stdout/options.json +3 -0
  63. package/__tests__/dbml2sql/multifile tablegroup pulling stdout/stdout.txt +12 -0
  64. package/__tests__/dbml2sql/multifile transitive reuse stdout/dbml-error.log +0 -0
  65. package/__tests__/dbml2sql/multifile transitive reuse stdout/in-files/base.dbml +6 -0
  66. package/__tests__/dbml2sql/multifile transitive reuse stdout/in-files/main.dbml +7 -0
  67. package/__tests__/dbml2sql/multifile transitive reuse stdout/in-files/types.dbml +4 -0
  68. package/__tests__/dbml2sql/multifile transitive reuse stdout/options.json +3 -0
  69. package/__tests__/dbml2sql/multifile transitive reuse stdout/stdout.txt +20 -0
  70. package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  71. package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  72. package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +1 -1
  73. package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  74. package/__tests__/dbml2sql/single file stdout/dbml-error.log +0 -0
  75. package/__tests__/dbml2sql/single file stdout/in-files/schema.dbml +11 -0
  76. package/__tests__/dbml2sql/single file stdout/options.json +3 -0
  77. package/__tests__/dbml2sql/single file stdout/stdout.txt +14 -0
  78. package/__tests__/dbml2sql/syntax-error/dbml-error.log +116 -0
  79. package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +44 -0
  80. package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +44 -0
  81. package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +44 -0
  82. package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +44 -0
  83. package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +44 -0
  84. package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +44 -0
  85. package/__tests__/sql2dbml/syntax-error/dbml-error.log +44 -0
  86. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +44 -0
  87. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +44 -0
  88. package/lib/index.js +44 -91
  89. package/package.json +5 -5
  90. package/src/NodeProjectLayout.ts +31 -89
  91. package/src/cli/connector.ts +5 -2
  92. package/src/cli/export.ts +19 -18
  93. package/src/cli/import.ts +7 -3
  94. package/src/helpers/logger.ts +4 -23
@@ -132,3 +132,47 @@ undefined
132
132
 
133
133
  You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
134
134
 
135
+ 2026-05-07T08:40:42.906Z
136
+
137
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
138
+
139
+ 2026-05-07T08:42:37.754Z
140
+
141
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
142
+
143
+ 2026-05-12T10:00:08.813Z
144
+
145
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
146
+
147
+ 2026-05-14T03:41:50.248Z
148
+
149
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
150
+
151
+ 2026-05-14T03:43:52.145Z
152
+
153
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
154
+
155
+ 2026-05-14T03:45:11.988Z
156
+
157
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
158
+
159
+ 2026-05-14T08:28:21.468Z
160
+
161
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
162
+
163
+ 2026-05-14T08:29:46.589Z
164
+
165
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
166
+
167
+ 2026-05-14T08:36:33.557Z
168
+
169
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
170
+
171
+ 2026-05-14T08:47:44.568Z
172
+
173
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
174
+
175
+ 2026-05-14T15:04:26.055Z
176
+
177
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
178
+
@@ -132,3 +132,47 @@ undefined
132
132
 
133
133
  You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
134
134
 
135
+ 2026-05-07T08:40:44.510Z
136
+
137
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
138
+
139
+ 2026-05-07T08:42:39.340Z
140
+
141
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
142
+
143
+ 2026-05-12T10:00:10.389Z
144
+
145
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
146
+
147
+ 2026-05-14T03:41:51.829Z
148
+
149
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
150
+
151
+ 2026-05-14T03:43:53.701Z
152
+
153
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
154
+
155
+ 2026-05-14T03:45:13.743Z
156
+
157
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
158
+
159
+ 2026-05-14T08:28:22.791Z
160
+
161
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
162
+
163
+ 2026-05-14T08:29:48.117Z
164
+
165
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
166
+
167
+ 2026-05-14T08:36:34.934Z
168
+
169
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
170
+
171
+ 2026-05-14T08:47:46.042Z
172
+
173
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
174
+
175
+ 2026-05-14T15:04:27.596Z
176
+
177
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
178
+
@@ -132,3 +132,47 @@ undefined
132
132
 
133
133
  You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
134
134
 
135
+ 2026-05-07T08:40:46.177Z
136
+
137
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
138
+
139
+ 2026-05-07T08:42:40.824Z
140
+
141
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
142
+
143
+ 2026-05-12T10:00:12.045Z
144
+
145
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
146
+
147
+ 2026-05-14T03:41:53.317Z
148
+
149
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
150
+
151
+ 2026-05-14T03:43:55.244Z
152
+
153
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
154
+
155
+ 2026-05-14T03:45:15.351Z
156
+
157
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
158
+
159
+ 2026-05-14T08:28:24.134Z
160
+
161
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
162
+
163
+ 2026-05-14T08:29:49.707Z
164
+
165
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
166
+
167
+ 2026-05-14T08:36:36.321Z
168
+
169
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
170
+
171
+ 2026-05-14T08:47:47.513Z
172
+
173
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
174
+
175
+ 2026-05-14T15:04:29.054Z
176
+
177
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
178
+
@@ -132,3 +132,47 @@ undefined
132
132
 
133
133
  You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
134
134
 
135
+ 2026-05-07T08:40:47.729Z
136
+
137
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
138
+
139
+ 2026-05-07T08:42:42.345Z
140
+
141
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
142
+
143
+ 2026-05-12T10:00:13.619Z
144
+
145
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
146
+
147
+ 2026-05-14T03:41:54.894Z
148
+
149
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
150
+
151
+ 2026-05-14T03:43:56.772Z
152
+
153
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
154
+
155
+ 2026-05-14T03:45:16.925Z
156
+
157
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
158
+
159
+ 2026-05-14T08:28:25.510Z
160
+
161
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
162
+
163
+ 2026-05-14T08:29:51.069Z
164
+
165
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
166
+
167
+ 2026-05-14T08:36:37.746Z
168
+
169
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
170
+
171
+ 2026-05-14T08:47:48.962Z
172
+
173
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
174
+
175
+ 2026-05-14T15:04:30.525Z
176
+
177
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
178
+
@@ -119,3 +119,47 @@ undefined
119
119
 
120
120
  You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
121
121
 
122
+ 2026-05-07T08:41:20.977Z
123
+
124
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
125
+
126
+ 2026-05-07T08:43:18.594Z
127
+
128
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
129
+
130
+ 2026-05-12T10:00:47.485Z
131
+
132
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
133
+
134
+ 2026-05-14T03:42:28.003Z
135
+
136
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
137
+
138
+ 2026-05-14T03:44:33.319Z
139
+
140
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
141
+
142
+ 2026-05-14T03:45:49.962Z
143
+
144
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
145
+
146
+ 2026-05-14T08:28:55.830Z
147
+
148
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
149
+
150
+ 2026-05-14T08:30:20.740Z
151
+
152
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
153
+
154
+ 2026-05-14T08:37:08.659Z
155
+
156
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
157
+
158
+ 2026-05-14T08:48:19.263Z
159
+
160
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
161
+
162
+ 2026-05-14T15:05:02.652Z
163
+
164
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
165
+
@@ -116,3 +116,47 @@ undefined
116
116
 
117
117
  You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
118
118
 
119
+ 2026-05-07T08:41:22.546Z
120
+
121
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
122
+
123
+ 2026-05-07T08:43:20.245Z
124
+
125
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
126
+
127
+ 2026-05-12T10:00:49.171Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
130
+
131
+ 2026-05-14T03:42:29.627Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
134
+
135
+ 2026-05-14T03:44:35.200Z
136
+
137
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
138
+
139
+ 2026-05-14T03:45:51.427Z
140
+
141
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
142
+
143
+ 2026-05-14T08:28:57.422Z
144
+
145
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
146
+
147
+ 2026-05-14T08:30:22.205Z
148
+
149
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
150
+
151
+ 2026-05-14T08:37:10.193Z
152
+
153
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
154
+
155
+ 2026-05-14T08:48:20.688Z
156
+
157
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
158
+
159
+ 2026-05-14T15:05:04.181Z
160
+
161
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
162
+
@@ -112,3 +112,47 @@ undefined
112
112
 
113
113
  You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
114
114
 
115
+ 2026-05-07T08:41:24.076Z
116
+
117
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
118
+
119
+ 2026-05-07T08:43:21.697Z
120
+
121
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
122
+
123
+ 2026-05-12T10:00:50.634Z
124
+
125
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
126
+
127
+ 2026-05-14T03:42:31.059Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
130
+
131
+ 2026-05-14T03:44:37.478Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
134
+
135
+ 2026-05-14T03:45:52.813Z
136
+
137
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
138
+
139
+ 2026-05-14T08:28:58.786Z
140
+
141
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
142
+
143
+ 2026-05-14T08:30:23.569Z
144
+
145
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
146
+
147
+ 2026-05-14T08:37:11.577Z
148
+
149
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
150
+
151
+ 2026-05-14T08:48:22.035Z
152
+
153
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
154
+
155
+ 2026-05-14T15:05:05.577Z
156
+
157
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
158
+
package/lib/index.js CHANGED
@@ -29,8 +29,6 @@ let chalk = require("chalk");
29
29
  chalk = __toESM(chalk);
30
30
  let figures = require("figures");
31
31
  figures = __toESM(figures);
32
- let strip_ansi = require("strip-ansi");
33
- strip_ansi = __toESM(strip_ansi);
34
32
  let winston = require("winston");
35
33
  let fs = require("fs");
36
34
  fs = __toESM(fs);
@@ -38,7 +36,7 @@ let __dbml_parse = require("@dbml/parse");
38
36
  let node_fs = require("node:fs");
39
37
  const $schema = "https://json.schemastore.org/package";
40
38
  const name = "@dbml/cli";
41
- const version = "8.0.0-alpha.8";
39
+ const version = "8.0.0-prerelease.0";
42
40
  const description = "";
43
41
  const main = "lib/index.js";
44
42
  const license = "Apache-2.0";
@@ -64,9 +62,9 @@ const repository = "https://github.com/holistics/dbml/tree/master/packages/dbml-
64
62
  const keywords = ["dbml", "dbml-cli"];
65
63
  const dependencies = {
66
64
  "@babel/cli": "^7.21.0",
67
- "@dbml/connector": "^8.0.0-alpha.0",
68
- "@dbml/core": "^8.0.0-alpha.8",
69
- "@dbml/parse": "^8.0.0-alpha.8",
65
+ "@dbml/connector": "^8.0.0-prerelease.0",
66
+ "@dbml/core": "^8.0.0-prerelease.0",
67
+ "@dbml/parse": "^8.0.0-prerelease.0",
70
68
  "bluebird": "^3.5.5",
71
69
  "chalk": "^2.4.2",
72
70
  "commander": "^2.20.0",
@@ -77,7 +75,7 @@ const dependencies = {
77
75
  "strip-ansi": "^5.2.0",
78
76
  "winston": "^3.2.1"
79
77
  };
80
- const gitHead = "ddb14ef16808f03119bcdc7e28dc88e254a4e21f";
78
+ const gitHead = "10981029ac3526ebd6fdb61fbce80299e42c5f5f";
81
79
  const engines = { "node": ">=18" };
82
80
  var package_default = {
83
81
  $schema,
@@ -106,7 +104,7 @@ var consoleFormat = printf((info) => {
106
104
  });
107
105
  var fileFormat = printf((info) => {
108
106
  const { timestamp: ts, message, stack, rootError } = info;
109
- let logContent = `${ts}\n${(0, strip_ansi.default)(stack ?? message ?? "")}\n`;
107
+ let logContent = `${ts}\n${stack ?? message ?? ""}\n`;
110
108
  if (rootError) {
111
109
  logContent += "\nROOT_ERROR:";
112
110
  logContent += `\n${rootError.stack}`;
@@ -115,33 +113,17 @@ var fileFormat = printf((info) => {
115
113
  }
116
114
  return logContent;
117
115
  });
118
- var consoleLogger = (0, winston.createLogger)({
116
+ const consoleLogger = (0, winston.createLogger)({
119
117
  format: combine(consoleFormat),
120
118
  transports: [new winston.transports.Console({ level: "error" })]
121
119
  });
122
- var fileLogger = (0, winston.createLogger)({
123
- format: combine(timestamp(), fileFormat),
120
+ const fileLogger = (0, winston.createLogger)({
121
+ format: combine(timestamp(), winston.format.uncolorize(), fileFormat),
124
122
  transports: [new winston.transports.File({
125
123
  filename: "dbml-error.log",
126
124
  level: "error"
127
125
  })]
128
126
  });
129
- var logger = {
130
- debug(msg) {
131
- consoleLogger.debug(msg);
132
- },
133
- info(msg) {
134
- consoleLogger.info(msg);
135
- },
136
- warn(msg) {
137
- consoleLogger.warn(msg);
138
- },
139
- error(msg) {
140
- consoleLogger.error(msg);
141
- fileLogger.error(msg);
142
- }
143
- };
144
- var logger_default = logger;
145
127
  var OutputConsolePlugin = class {
146
128
  static write(content) {
147
129
  console.log(content);
@@ -514,8 +496,8 @@ ListCache.prototype.get = _listCacheGet_default;
514
496
  ListCache.prototype.has = _listCacheHas_default;
515
497
  ListCache.prototype.set = _listCacheSet_default;
516
498
  var _ListCache_default = ListCache;
517
- var Map$1 = _getNative_default(_root_default, "Map");
518
- var _Map_default = Map$1;
499
+ var Map = _getNative_default(_root_default, "Map");
500
+ var _Map_default = Map;
519
501
  function mapCacheClear() {
520
502
  this.size = 0;
521
503
  this.__data__ = {
@@ -728,8 +710,8 @@ var DataView = _getNative_default(_root_default, "DataView");
728
710
  var _DataView_default = DataView;
729
711
  var Promise$1 = _getNative_default(_root_default, "Promise");
730
712
  var _Promise_default = Promise$1;
731
- var Set$1 = _getNative_default(_root_default, "Set");
732
- var _Set_default = Set$1;
713
+ var Set = _getNative_default(_root_default, "Set");
714
+ var _Set_default = Set;
733
715
  var mapTag$2 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$2 = "[object Set]", weakMapTag = "[object WeakMap]";
734
716
  var dataViewTag$1 = "[object DataView]";
735
717
  var dataViewCtorString = _toSource_default(_DataView_default), mapCtorString = _toSource_default(_Map_default), promiseCtorString = _toSource_default(_Promise_default), setCtorString = _toSource_default(_Set_default), weakMapCtorString = _toSource_default(_WeakMap_default);
@@ -1177,79 +1159,47 @@ async function connectionHandler(program$1) {
1177
1159
  console.log(` ${chalk.default.green(figures.default.main.tick)} Generated DBML file from database's connection: ${path.default.basename(opts.outFile)}`);
1178
1160
  }
1179
1161
  } catch (error) {
1180
- logger_default.error(error);
1162
+ consoleLogger.error(error);
1163
+ fileLogger.error(error);
1181
1164
  }
1182
1165
  }
1183
- var NodeProjectLayout = class NodeProjectLayout {
1166
+ var NodeProjectLayout = class {
1184
1167
  constructor(entryPoints) {
1185
- this.overlay = /* @__PURE__ */ new Map();
1186
1168
  this.entryPoints = [...entryPoints];
1187
1169
  }
1188
- setSource(filePath, content) {
1189
- this.overlay.set(filePath.absolute, content);
1190
- }
1191
1170
  getSource(filePath) {
1192
- const absolutePath = filePath.absolute;
1193
- if (this.overlay.has(absolutePath)) return this.overlay.get(absolutePath) ?? void 0;
1194
- try {
1195
- return (0, node_fs.readFileSync)(absolutePath, "utf-8");
1196
- } catch {
1197
- return;
1198
- }
1199
- }
1200
- deleteSource(filePath) {
1201
- this.overlay.set(filePath.absolute, null);
1202
- }
1203
- clearSource() {
1204
- this.overlay.clear();
1205
- this.entryPoints = [];
1171
+ return safeReadFileSync(filePath.absolute, "utf-8");
1206
1172
  }
1207
1173
  exists(filePath) {
1208
1174
  return this.isFile(filePath) || this.isDirectory(filePath);
1209
1175
  }
1210
1176
  isFile(filePath) {
1211
- const absolutePath = filePath.absolute;
1212
- if (this.overlay.has(absolutePath)) return this.overlay.get(absolutePath) !== null;
1213
- try {
1214
- return (0, node_fs.statSync)(absolutePath).isFile();
1215
- } catch {
1216
- return false;
1217
- }
1177
+ return safeStatSync(filePath.absolute, { throwIfNoEntry: false })?.isFile() ?? false;
1218
1178
  }
1219
1179
  isDirectory(filePath) {
1220
- const absolutePath = filePath.absolute;
1221
- try {
1222
- if ((0, node_fs.statSync)(absolutePath).isDirectory()) return true;
1223
- } catch {}
1224
- for (const [overlayPath, content] of this.overlay) {
1225
- if (content === null) continue;
1226
- if (overlayPath.startsWith(absolutePath)) return true;
1227
- }
1228
- return false;
1180
+ return safeStatSync(filePath.absolute, { throwIfNoEntry: false })?.isDirectory() ?? false;
1229
1181
  }
1230
1182
  listDirectory(dirPath) {
1231
1183
  const basePath = dirPath?.absolute ?? "/";
1232
- const results = /* @__PURE__ */ new Set();
1233
- try {
1234
- for (const entry of (0, node_fs.readdirSync)(basePath)) results.add(basePath + entry);
1235
- } catch {}
1236
- for (const [abs, content] of this.overlay) {
1237
- if (content === null) continue;
1238
- if (!abs.startsWith(basePath)) continue;
1239
- if (!abs.slice(basePath.length).includes("/")) results.add(abs);
1240
- }
1241
- for (const [overlayPath, content] of this.overlay) if (content === null) results.delete(overlayPath);
1242
- return [...results].sort().map(__dbml_parse.Filepath.from);
1184
+ return safeReaddirSync(basePath)?.map((entry) => basePath + entry).sort().map(__dbml_parse.Filepath.from) ?? [];
1243
1185
  }
1244
- getEntryPoints() {
1186
+ getEntrypoints() {
1245
1187
  return this.entryPoints.filter((fp) => this.exists(fp));
1246
1188
  }
1247
- clone() {
1248
- const copy = new NodeProjectLayout([...this.entryPoints]);
1249
- for (const [overlayPath, content] of this.overlay) copy.overlay.set(overlayPath, content);
1250
- return copy;
1251
- }
1252
1189
  };
1190
+ function logOnError(fn) {
1191
+ return (...args) => {
1192
+ try {
1193
+ return fn(...args);
1194
+ } catch (e) {
1195
+ fileLogger.error(e instanceof Error ? e : new Error(String(e)));
1196
+ return;
1197
+ }
1198
+ };
1199
+ }
1200
+ var safeReadFileSync = logOnError(node_fs.readFileSync);
1201
+ var safeReaddirSync = logOnError(node_fs.readdirSync);
1202
+ var safeStatSync = logOnError((path$6, opts) => (0, node_fs.statSync)(path$6, opts));
1253
1203
  var config = {
1254
1204
  mysql: { name: "MySQL" },
1255
1205
  mysqlLegacy: { name: "MySQL" },
@@ -1268,27 +1218,28 @@ async function exportHandler(program$1) {
1268
1218
  validateInputFilePaths(inputPaths, validateFilePlugin);
1269
1219
  const opts = program$1.opts();
1270
1220
  const format$1 = getFormatOpt(opts);
1271
- const entryPoints = inputPaths.map((p) => new __dbml_parse.Filepath(p));
1272
- const compiler = new __dbml_parse.Compiler();
1273
- compiler.layout = new NodeProjectLayout(entryPoints);
1221
+ const entrypoints = inputPaths.map((p) => new __dbml_parse.Filepath(p));
1222
+ const compiler = new __dbml_parse.Compiler(new NodeProjectLayout(entrypoints));
1274
1223
  const outputPlugin = opts.outFile ? new outputFilePlugin_default(resolvePaths(opts.outFile), [
1275
1224
  "-- SQL dump generated using DBML (dbml.dbdiagram.io)\n",
1276
1225
  `-- Database: ${config_default[format$1].name}\n`,
1277
1226
  `-- Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}\n\n`
1278
1227
  ].join("")) : outputConsolePlugin_default;
1279
1228
  let hasErrors = false;
1280
- for (const filepath of entryPoints) {
1229
+ for (const filepath of entrypoints) {
1281
1230
  const result = compiler.interpretFile(filepath);
1282
1231
  const errors = result.getErrors();
1283
1232
  if (errors.length > 0) {
1284
1233
  hasErrors = true;
1285
1234
  const isMultifile = compiler.reachableFiles(filepath).length > 1;
1286
- logger_default.error(`\n ${errors.map((e) => {
1235
+ const msg = `\n ${errors.map((e) => {
1287
1236
  const pos = e.nodeOrToken.startPos;
1288
1237
  const line = pos.line + 1;
1289
1238
  const col = pos.column + 1;
1290
1239
  return `${chalk.default.cyan(isMultifile ? e.filepath.relativeTo(process.cwd()) : e.filepath.basename)}${chalk.default.yellow(`(${line},${col})`)}: ${e.message}`;
1291
- }).join("\n ")}`);
1240
+ }).join("\n ")}`;
1241
+ consoleLogger.error(msg);
1242
+ fileLogger.error(msg);
1292
1243
  continue;
1293
1244
  }
1294
1245
  const db = result.getValue();
@@ -1330,7 +1281,9 @@ async function importHandler(program$1) {
1330
1281
  }
1331
1282
  } catch (error) {
1332
1283
  if (error instanceof __dbml_core.CompilerError) {
1333
- logger_default.error(`\n ${error.diags.map((diag) => new syntaxError_default(diag.filepath ?? "", diag)).map(({ message }) => message).join("\n ")}`);
1284
+ const msg = `\n ${error.diags.map((diag) => new syntaxError_default(diag.filepath ?? "", diag)).map(({ message }) => message).join("\n ")}`;
1285
+ consoleLogger.error(msg);
1286
+ fileLogger.error(msg);
1334
1287
  return;
1335
1288
  }
1336
1289
  throw error;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@dbml/cli",
4
- "version": "8.0.0-alpha.8",
4
+ "version": "8.0.0-prerelease.0",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "license": "Apache-2.0",
@@ -32,9 +32,9 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@babel/cli": "^7.21.0",
35
- "@dbml/connector": "^8.0.0-alpha.0",
36
- "@dbml/core": "^8.0.0-alpha.8",
37
- "@dbml/parse": "^8.0.0-alpha.8",
35
+ "@dbml/connector": "^8.0.0-prerelease.0",
36
+ "@dbml/core": "^8.0.0-prerelease.0",
37
+ "@dbml/parse": "^8.0.0-prerelease.0",
38
38
  "bluebird": "^3.5.5",
39
39
  "chalk": "^2.4.2",
40
40
  "commander": "^2.20.0",
@@ -45,7 +45,7 @@
45
45
  "strip-ansi": "^5.2.0",
46
46
  "winston": "^3.2.1"
47
47
  },
48
- "gitHead": "ddb14ef16808f03119bcdc7e28dc88e254a4e21f",
48
+ "gitHead": "10981029ac3526ebd6fdb61fbce80299e42c5f5f",
49
49
  "engines": {
50
50
  "node": ">=18"
51
51
  }