@dbml/cli 3.6.2 → 3.7.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 (295) hide show
  1. package/.babelrc +0 -0
  2. package/LICENSE +0 -0
  3. package/README.md +0 -0
  4. package/__test__/cli.test.js +7 -1
  5. package/__test__/db2dbml/mssql/dbml-error.log +467 -0
  6. package/__test__/db2dbml/mssql/expect-out-files/schema.dbml +190 -0
  7. package/__test__/db2dbml/mssql/options.json +8 -0
  8. package/__test__/db2dbml/mssql/schema.sql +296 -0
  9. package/__test__/db2dbml/mssql/stdout.txt +1 -0
  10. package/__test__/db2dbml/mysql/dbml-error.log +281 -0
  11. package/__test__/db2dbml/mysql/expect-out-files/schema.dbml +180 -0
  12. package/__test__/db2dbml/mysql/options.json +8 -0
  13. package/__test__/db2dbml/mysql/out-files/schema.dbml +180 -0
  14. package/__test__/db2dbml/mysql/schema.sql +141 -0
  15. package/__test__/db2dbml/mysql/stdout.txt +1 -0
  16. package/__test__/db2dbml/postgres/dbml-error.log +252 -0
  17. package/__test__/db2dbml/postgres/expect-out-files/schema.dbml +140 -0
  18. package/__test__/db2dbml/postgres/options.json +8 -0
  19. package/__test__/db2dbml/postgres/out-files/schema.dbml +140 -0
  20. package/__test__/db2dbml/postgres/schema.sql +156 -0
  21. package/__test__/db2dbml/postgres/stdout.txt +1 -0
  22. package/__test__/db2dbml_bin.js +5 -0
  23. package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -36
  24. package/__test__/dbml2sql/filename --mysql --out-file/expect-out-files/schema.sql +0 -0
  25. package/__test__/dbml2sql/filename --mysql --out-file/in-files/schema.dbml +0 -0
  26. package/__test__/dbml2sql/filename --mysql --out-file/options.json +0 -0
  27. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  28. package/__test__/dbml2sql/filename --mysql --out-file/stdout.txt +0 -0
  29. package/__test__/dbml2sql/filename --mysql stdout/dbml-error.log +0 -0
  30. package/__test__/dbml2sql/filename --mysql stdout/in-files/schema.dbml +0 -0
  31. package/__test__/dbml2sql/filename --mysql stdout/options.json +0 -0
  32. package/__test__/dbml2sql/filename --mysql stdout/stdout.txt +0 -0
  33. package/__test__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
  34. package/__test__/dbml2sql/filename --oracle --out-file/expect-out-files/schema.sql +0 -0
  35. package/__test__/dbml2sql/filename --oracle --out-file/in-files/schema.dbml +0 -0
  36. package/__test__/dbml2sql/filename --oracle --out-file/options.json +0 -0
  37. package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +1 -1
  38. package/__test__/dbml2sql/filename --oracle --out-file/stdout.txt +0 -0
  39. package/__test__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
  40. package/__test__/dbml2sql/filename --oracle stdout/in-files/schema.dbml +0 -0
  41. package/__test__/dbml2sql/filename --oracle stdout/options.json +0 -0
  42. package/__test__/dbml2sql/filename --oracle stdout/stdout.txt +0 -0
  43. package/__test__/dbml2sql/filename --out-file/dbml-error.log +0 -36
  44. package/__test__/dbml2sql/filename --out-file/expect-out-files/schema.sql +0 -0
  45. package/__test__/dbml2sql/filename --out-file/in-files/schema.dbml +0 -0
  46. package/__test__/dbml2sql/filename --out-file/options.json +0 -0
  47. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  48. package/__test__/dbml2sql/filename --out-file/stdout.txt +0 -0
  49. package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -24
  50. package/__test__/dbml2sql/filename --postgres --out-file/expect-out-files/schema.sql +0 -0
  51. package/__test__/dbml2sql/filename --postgres --out-file/in-files/schema.dbml +0 -0
  52. package/__test__/dbml2sql/filename --postgres --out-file/options.json +0 -0
  53. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  54. package/__test__/dbml2sql/filename --postgres --out-file/stdout.txt +0 -0
  55. package/__test__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
  56. package/__test__/dbml2sql/filename --postgres stdout/in-files/schema.dbml +0 -0
  57. package/__test__/dbml2sql/filename --postgres stdout/options.json +0 -0
  58. package/__test__/dbml2sql/filename --postgres stdout/stdout.txt +0 -0
  59. package/__test__/dbml2sql/filename stdout/dbml-error.log +0 -0
  60. package/__test__/dbml2sql/filename stdout/in-files/schema.dbml +0 -0
  61. package/__test__/dbml2sql/filename stdout/options.json +0 -0
  62. package/__test__/dbml2sql/filename stdout/stdout.txt +0 -0
  63. package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -24
  64. package/__test__/dbml2sql/filenames --mysql --out-file/expect-out-files/schema.sql +0 -0
  65. package/__test__/dbml2sql/filenames --mysql --out-file/in-files/business.dbml +0 -0
  66. package/__test__/dbml2sql/filenames --mysql --out-file/in-files/customer.dbml +0 -0
  67. package/__test__/dbml2sql/filenames --mysql --out-file/in-files/inventory.dbml +0 -0
  68. package/__test__/dbml2sql/filenames --mysql --out-file/options.json +0 -0
  69. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  70. package/__test__/dbml2sql/filenames --mysql --out-file/stdout.txt +0 -0
  71. package/__test__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
  72. package/__test__/dbml2sql/filenames --mysql stdout/in-files/business.dbml +0 -0
  73. package/__test__/dbml2sql/filenames --mysql stdout/in-files/customer.dbml +0 -0
  74. package/__test__/dbml2sql/filenames --mysql stdout/in-files/inventory.dbml +0 -0
  75. package/__test__/dbml2sql/filenames --mysql stdout/options.json +0 -0
  76. package/__test__/dbml2sql/filenames --mysql stdout/stdout.txt +0 -0
  77. package/__test__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
  78. package/__test__/dbml2sql/filenames --oracle --out-file/expect-out-files/schema.sql +0 -0
  79. package/__test__/dbml2sql/filenames --oracle --out-file/in-files/business.dbml +0 -0
  80. package/__test__/dbml2sql/filenames --oracle --out-file/in-files/customer.dbml +0 -0
  81. package/__test__/dbml2sql/filenames --oracle --out-file/in-files/inventory.dbml +0 -0
  82. package/__test__/dbml2sql/filenames --oracle --out-file/options.json +0 -0
  83. package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +1 -1
  84. package/__test__/dbml2sql/filenames --oracle --out-file/stdout.txt +0 -0
  85. package/__test__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
  86. package/__test__/dbml2sql/filenames --oracle stdout/in-files/business.dbml +0 -0
  87. package/__test__/dbml2sql/filenames --oracle stdout/in-files/customer.dbml +0 -0
  88. package/__test__/dbml2sql/filenames --oracle stdout/in-files/inventory.dbml +0 -0
  89. package/__test__/dbml2sql/filenames --oracle stdout/options.json +0 -0
  90. package/__test__/dbml2sql/filenames --oracle stdout/stdout.txt +0 -0
  91. package/__test__/dbml2sql/filenames --out-file/dbml-error.log +0 -24
  92. package/__test__/dbml2sql/filenames --out-file/expect-out-files/schema.sql +0 -0
  93. package/__test__/dbml2sql/filenames --out-file/in-files/business.dbml +0 -0
  94. package/__test__/dbml2sql/filenames --out-file/in-files/customer.dbml +0 -0
  95. package/__test__/dbml2sql/filenames --out-file/in-files/inventory.dbml +0 -0
  96. package/__test__/dbml2sql/filenames --out-file/options.json +0 -0
  97. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  98. package/__test__/dbml2sql/filenames --out-file/stdout.txt +0 -0
  99. package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -24
  100. package/__test__/dbml2sql/filenames --postgres --out-file/expect-out-files/schema.sql +0 -0
  101. package/__test__/dbml2sql/filenames --postgres --out-file/in-files/business.dbml +0 -0
  102. package/__test__/dbml2sql/filenames --postgres --out-file/in-files/customer.dbml +0 -0
  103. package/__test__/dbml2sql/filenames --postgres --out-file/in-files/inventory.dbml +0 -0
  104. package/__test__/dbml2sql/filenames --postgres --out-file/options.json +0 -0
  105. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  106. package/__test__/dbml2sql/filenames --postgres --out-file/stdout.txt +0 -0
  107. package/__test__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
  108. package/__test__/dbml2sql/filenames --postgres stdout/in-files/business.dbml +0 -0
  109. package/__test__/dbml2sql/filenames --postgres stdout/in-files/customer.dbml +0 -0
  110. package/__test__/dbml2sql/filenames --postgres stdout/in-files/inventory.dbml +0 -0
  111. package/__test__/dbml2sql/filenames --postgres stdout/options.json +0 -0
  112. package/__test__/dbml2sql/filenames --postgres stdout/stdout.txt +0 -0
  113. package/__test__/dbml2sql/filenames stdout/dbml-error.log +0 -0
  114. package/__test__/dbml2sql/filenames stdout/in-files/business.dbml +0 -0
  115. package/__test__/dbml2sql/filenames stdout/in-files/customer.dbml +0 -0
  116. package/__test__/dbml2sql/filenames stdout/in-files/inventory.dbml +0 -0
  117. package/__test__/dbml2sql/filenames stdout/options.json +0 -0
  118. package/__test__/dbml2sql/filenames stdout/stdout.txt +0 -0
  119. package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -24
  120. package/__test__/dbml2sql/multiple_schema_mssql/expect-out-files/multiple_schema.out.sql +0 -0
  121. package/__test__/dbml2sql/multiple_schema_mssql/in-files/multiple_schema.in.dbml +0 -0
  122. package/__test__/dbml2sql/multiple_schema_mssql/options.json +0 -0
  123. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  124. package/__test__/dbml2sql/multiple_schema_mssql/stdout.txt +0 -0
  125. package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -24
  126. package/__test__/dbml2sql/multiple_schema_mysql/expect-out-files/multiple_schema.out.sql +0 -0
  127. package/__test__/dbml2sql/multiple_schema_mysql/in-files/multiple_schema.in.dbml +0 -0
  128. package/__test__/dbml2sql/multiple_schema_mysql/options.json +0 -0
  129. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  130. package/__test__/dbml2sql/multiple_schema_mysql/stdout.txt +0 -0
  131. package/__test__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
  132. package/__test__/dbml2sql/multiple_schema_oracle/expect-out-files/multiple_schema.out.sql +0 -0
  133. package/__test__/dbml2sql/multiple_schema_oracle/in-files/multiple_schema.in.dbml +0 -0
  134. package/__test__/dbml2sql/multiple_schema_oracle/options.json +0 -0
  135. package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +1 -1
  136. package/__test__/dbml2sql/multiple_schema_oracle/stdout.txt +0 -0
  137. package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -24
  138. package/__test__/dbml2sql/multiple_schema_pg/expect-out-files/multiple_schema.out.sql +0 -0
  139. package/__test__/dbml2sql/multiple_schema_pg/in-files/multiple_schema.in.dbml +0 -0
  140. package/__test__/dbml2sql/multiple_schema_pg/options.json +0 -0
  141. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  142. package/__test__/dbml2sql/multiple_schema_pg/stdout.txt +0 -0
  143. package/__test__/dbml2sql/syntax-error/dbml-error.log +7 -2104
  144. package/__test__/dbml2sql/syntax-error/in-files/ecommerce.dbml +0 -0
  145. package/__test__/dbml2sql/syntax-error/options.json +0 -0
  146. package/__test__/dbml2sql/syntax-error/stdout.txt +0 -0
  147. package/__test__/dbml2sql_bin.js +0 -0
  148. package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -51
  149. package/__test__/sql2dbml/filename --mssql --out-file/expect-out-files/schema.dbml +0 -0
  150. package/__test__/sql2dbml/filename --mssql --out-file/in-files/schema.sql +0 -0
  151. package/__test__/sql2dbml/filename --mssql --out-file/options.json +0 -0
  152. package/__test__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +0 -0
  153. package/__test__/sql2dbml/filename --mssql --out-file/stdout.txt +0 -0
  154. package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -24
  155. package/__test__/sql2dbml/filename --mysql --out-file/expect-out-files/schema.dbml +0 -0
  156. package/__test__/sql2dbml/filename --mysql --out-file/in-files/schema.sql +0 -0
  157. package/__test__/sql2dbml/filename --mysql --out-file/options.json +0 -0
  158. package/__test__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +0 -0
  159. package/__test__/sql2dbml/filename --mysql --out-file/stdout.txt +0 -0
  160. package/__test__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
  161. package/__test__/sql2dbml/filename --mysql stdout/in-files/schema.sql +0 -0
  162. package/__test__/sql2dbml/filename --mysql stdout/options.json +0 -0
  163. package/__test__/sql2dbml/filename --mysql stdout/stdout.txt +0 -0
  164. package/__test__/sql2dbml/filename --out-file/dbml-error.log +0 -24
  165. package/__test__/sql2dbml/filename --out-file/expect-out-files/schema.dbml +0 -0
  166. package/__test__/sql2dbml/filename --out-file/in-files/schema.sql +0 -0
  167. package/__test__/sql2dbml/filename --out-file/options.json +0 -0
  168. package/__test__/sql2dbml/filename --out-file/out-files/schema.dbml +0 -0
  169. package/__test__/sql2dbml/filename --out-file/stdout.txt +0 -0
  170. package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -24
  171. package/__test__/sql2dbml/filename --postgres --out-file/expect-out-files/schema.dbml +0 -0
  172. package/__test__/sql2dbml/filename --postgres --out-file/in-files/schema.sql +0 -0
  173. package/__test__/sql2dbml/filename --postgres --out-file/options.json +0 -0
  174. package/__test__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +0 -0
  175. package/__test__/sql2dbml/filename --postgres --out-file/stdout.txt +0 -0
  176. package/__test__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
  177. package/__test__/sql2dbml/filename --postgres stdout/in-files/schema.sql +0 -0
  178. package/__test__/sql2dbml/filename --postgres stdout/options.json +0 -0
  179. package/__test__/sql2dbml/filename --postgres stdout/stdout.txt +0 -0
  180. package/__test__/sql2dbml/filename --snowflake stdout/dbml-error.log +0 -54
  181. package/__test__/sql2dbml/filename --snowflake stdout/in-files/schema.sql +0 -0
  182. package/__test__/sql2dbml/filename --snowflake stdout/options.json +0 -0
  183. package/__test__/sql2dbml/filename --snowflake stdout/stdout.txt +6 -6
  184. package/__test__/sql2dbml/filename stdout/dbml-error.log +0 -0
  185. package/__test__/sql2dbml/filename stdout/in-files/schema.sql +0 -0
  186. package/__test__/sql2dbml/filename stdout/options.json +0 -0
  187. package/__test__/sql2dbml/filename stdout/stdout.txt +0 -0
  188. package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -24
  189. package/__test__/sql2dbml/filenames --mysql --out-file/expect-out-files/schema.dbml +0 -0
  190. package/__test__/sql2dbml/filenames --mysql --out-file/in-files/business.sql +0 -0
  191. package/__test__/sql2dbml/filenames --mysql --out-file/in-files/customer.sql +0 -0
  192. package/__test__/sql2dbml/filenames --mysql --out-file/in-files/inventory.sql +0 -0
  193. package/__test__/sql2dbml/filenames --mysql --out-file/options.json +0 -0
  194. package/__test__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +0 -0
  195. package/__test__/sql2dbml/filenames --mysql --out-file/stdout.txt +0 -0
  196. package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
  197. package/__test__/sql2dbml/filenames --mysql stdout/in-files/business.sql +0 -0
  198. package/__test__/sql2dbml/filenames --mysql stdout/in-files/customer.sql +0 -0
  199. package/__test__/sql2dbml/filenames --mysql stdout/in-files/inventory.sql +0 -0
  200. package/__test__/sql2dbml/filenames --mysql stdout/options.json +0 -0
  201. package/__test__/sql2dbml/filenames --mysql stdout/stdout.txt +0 -0
  202. package/__test__/sql2dbml/filenames --out-file/dbml-error.log +0 -24
  203. package/__test__/sql2dbml/filenames --out-file/expect-out-files/schema.dbml +0 -0
  204. package/__test__/sql2dbml/filenames --out-file/in-files/business.sql +0 -0
  205. package/__test__/sql2dbml/filenames --out-file/in-files/customer.sql +0 -0
  206. package/__test__/sql2dbml/filenames --out-file/in-files/inventory.sql +0 -0
  207. package/__test__/sql2dbml/filenames --out-file/options.json +0 -0
  208. package/__test__/sql2dbml/filenames --out-file/out-files/schema.dbml +0 -0
  209. package/__test__/sql2dbml/filenames --out-file/stdout.txt +0 -0
  210. package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -24
  211. package/__test__/sql2dbml/filenames --postgres --out-file/expect-out-files/schema.dbml +0 -0
  212. package/__test__/sql2dbml/filenames --postgres --out-file/in-files/business.sql +0 -0
  213. package/__test__/sql2dbml/filenames --postgres --out-file/in-files/customer.sql +0 -0
  214. package/__test__/sql2dbml/filenames --postgres --out-file/in-files/inventory.sql +0 -0
  215. package/__test__/sql2dbml/filenames --postgres --out-file/options.json +0 -0
  216. package/__test__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +0 -0
  217. package/__test__/sql2dbml/filenames --postgres --out-file/stdout.txt +0 -0
  218. package/__test__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
  219. package/__test__/sql2dbml/filenames --postgres stdout/in-files/business.sql +0 -0
  220. package/__test__/sql2dbml/filenames --postgres stdout/in-files/customer.sql +0 -0
  221. package/__test__/sql2dbml/filenames --postgres stdout/in-files/inventory.sql +0 -0
  222. package/__test__/sql2dbml/filenames --postgres stdout/options.json +0 -0
  223. package/__test__/sql2dbml/filenames --postgres stdout/stdout.txt +0 -0
  224. package/__test__/sql2dbml/filenames stdout/dbml-error.log +0 -0
  225. package/__test__/sql2dbml/filenames stdout/in-files/business.sql +0 -0
  226. package/__test__/sql2dbml/filenames stdout/in-files/customer.sql +0 -0
  227. package/__test__/sql2dbml/filenames stdout/in-files/inventory.sql +0 -0
  228. package/__test__/sql2dbml/filenames stdout/options.json +0 -0
  229. package/__test__/sql2dbml/filenames stdout/stdout.txt +0 -0
  230. package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -121
  231. package/__test__/sql2dbml/multiple_schema_mssql/expect-out-files/multiple_schema.out.dbml +0 -0
  232. package/__test__/sql2dbml/multiple_schema_mssql/in-files/multiple_schema.in.sql +0 -0
  233. package/__test__/sql2dbml/multiple_schema_mssql/options.json +0 -0
  234. package/__test__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +0 -0
  235. package/__test__/sql2dbml/multiple_schema_mssql/stdout.txt +0 -0
  236. package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -104
  237. package/__test__/sql2dbml/multiple_schema_mysql/expect-out-files/multiple_schema.out.dbml +0 -0
  238. package/__test__/sql2dbml/multiple_schema_mysql/in-files/multiple_schema.in.sql +0 -0
  239. package/__test__/sql2dbml/multiple_schema_mysql/options.json +0 -0
  240. package/__test__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +0 -0
  241. package/__test__/sql2dbml/multiple_schema_mysql/stdout.txt +0 -0
  242. package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +0 -131
  243. package/__test__/sql2dbml/multiple_schema_pg/expect-out-files/multiple_schema.out.dbml +0 -0
  244. package/__test__/sql2dbml/multiple_schema_pg/in-files/multiple_schema.in.sql +0 -0
  245. package/__test__/sql2dbml/multiple_schema_pg/options.json +0 -0
  246. package/__test__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +0 -0
  247. package/__test__/sql2dbml/multiple_schema_pg/stdout.txt +0 -0
  248. package/__test__/sql2dbml/syntax-error/dbml-error.log +7 -2077
  249. package/__test__/sql2dbml/syntax-error/in-files/business.sql +0 -0
  250. package/__test__/sql2dbml/syntax-error/options.json +0 -0
  251. package/__test__/sql2dbml/syntax-error/stdout.txt +0 -0
  252. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +9 -27
  253. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/in-files/schema.sql +0 -0
  254. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/options.json +0 -0
  255. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/stdout.txt +0 -0
  256. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +7 -28
  257. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/in-files/schema.sql +0 -0
  258. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/options.json +0 -0
  259. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/stdout.txt +0 -0
  260. package/__test__/sql2dbml_bin.js +0 -0
  261. package/bin/db2dbml.js +4 -0
  262. package/dbml-error.log +52 -279
  263. package/jestHelpers.js +0 -0
  264. package/lib/cli/config.js +0 -0
  265. package/lib/cli/connector.js +6 -7
  266. package/lib/cli/export.js +0 -0
  267. package/lib/cli/import.js +0 -0
  268. package/lib/cli/index.js +28 -0
  269. package/lib/cli/outputPlugins/outputConsolePlugin.js +0 -0
  270. package/lib/cli/outputPlugins/outputFilePlugin.js +0 -0
  271. package/lib/cli/utils.js +20 -0
  272. package/lib/cli/validatePlugins/validatePlugins.js +0 -0
  273. package/lib/connectors/Connector.js +19 -0
  274. package/lib/connectors/MssqlConnector.js +483 -0
  275. package/lib/connectors/PostgresConnector.js +450 -0
  276. package/lib/errors/domainError.js +0 -0
  277. package/lib/errors/index.js +0 -0
  278. package/lib/errors/syntaxError.js +0 -0
  279. package/lib/helpers/logger.js +0 -0
  280. package/lib/index.js +6 -0
  281. package/package.json +5 -4
  282. package/src/cli/config.js +0 -0
  283. package/src/cli/connector.js +31 -0
  284. package/src/cli/export.js +0 -0
  285. package/src/cli/import.js +0 -0
  286. package/src/cli/index.js +35 -0
  287. package/src/cli/outputPlugins/outputConsolePlugin.js +0 -0
  288. package/src/cli/outputPlugins/outputFilePlugin.js +0 -0
  289. package/src/cli/utils.js +23 -0
  290. package/src/cli/validatePlugins/validatePlugins.js +0 -0
  291. package/src/errors/domainError.js +0 -0
  292. package/src/errors/index.js +0 -0
  293. package/src/errors/syntaxError.js +0 -0
  294. package/src/helpers/logger.js +0 -0
  295. package/src/index.js +2 -1
@@ -0,0 +1,141 @@
1
+ -- create table
2
+ create table users (
3
+ user_id int unsigned auto_increment primary key,
4
+ username varchar(50) unique not null,
5
+ email varchar(100) unique not null,
6
+ password_hash varchar(255) not null,
7
+ first_name varchar(50),
8
+ last_name varchar(50),
9
+ date_of_birth date,
10
+ created_at timestamp default current_timestamp,
11
+ last_login timestamp default now(),
12
+ is_active tinyint(1) default 1
13
+ );
14
+
15
+ create table products (
16
+ id int unsigned primary key auto_increment,
17
+ price decimal(10,2) not null,
18
+ quantity int not null,
19
+ total_value decimal(10,2) generated always as ((price * quantity)) stored,
20
+ updated_at timestamp default current_timestamp on update current_timestamp
21
+ );
22
+
23
+ create table orders (
24
+ order_id int unsigned auto_increment primary key,
25
+ user_id int unsigned
26
+ );
27
+
28
+ create table order_items (
29
+ order_id int unsigned not null,
30
+ product_id int unsigned not null
31
+ );
32
+
33
+ alter table order_items
34
+ add constraint fk_detail_items_orders
35
+ foreign key (order_id) references orders (order_id) on delete cascade;
36
+
37
+ alter table order_items
38
+ add constraint fk_detail_items_products
39
+ foreign key (product_id) references products (id) on delete no action;
40
+
41
+ alter table orders
42
+ add constraint fk_order_user
43
+ foreign key (user_id) references users (user_id) on delete set null;
44
+
45
+ create table if not exists categories (
46
+ cat_id int unsigned auto_increment,
47
+ cat_name varchar(50) not null,
48
+ super_cat_id int unsigned,
49
+ created_at timestamp default current_timestamp,
50
+
51
+ constraint pk_category primary key (cat_id),
52
+ fulltext fulltext_index_category (cat_name)
53
+ );
54
+
55
+ create table default_example (
56
+ id int auto_increment primary key,
57
+ column1 varchar(255) default (concat('default ', uuid())),
58
+ column2 varchar(255) default (concat('random ', floor(rand() * 100))),
59
+ column3 varchar(255) default '_utf8mb4',
60
+ column4 double default 0.5,
61
+ created_date date default (current_date),
62
+ first_date date default '2023-01-01',
63
+ event_time timestamp default '2024-01-01 00:00:00'
64
+ );
65
+
66
+ create table sqrt_triangle (
67
+ side_a double default null,
68
+ side_b double default null,
69
+ side_c double generated always as (sqrt(((side_a * side_a) + (side_b * side_b)))) virtual
70
+ );
71
+
72
+ -- composite foreign key, primary key, unique
73
+ create table composite_key_1 (
74
+ id1_1 int unsigned,
75
+ id1_2 int unsigned,
76
+
77
+ email varchar(255),
78
+ name varchar(50),
79
+ primary key (id1_1, id1_2)
80
+ );
81
+
82
+ alter table composite_key_1
83
+ add constraint uc_unique_composite unique (email, name);
84
+
85
+ create table composite_key_2 (
86
+ id2_1 int unsigned,
87
+ id2_2 int unsigned,
88
+
89
+ primary key (id2_1, id2_2)
90
+ );
91
+
92
+ alter table composite_key_1
93
+ add constraint fk_test_composite foreign key (id1_1, id1_2)
94
+ references composite_key_2 (id2_1, id2_2);
95
+
96
+ -- enum
97
+ create table status_example_2 (
98
+ s1 enum('active', 'inactive', 'pending') not null,
99
+ s2 enum('active', 'inactive', 'pending') default null,
100
+ s3 enum('active', 'inactive', 'pending') default 'active',
101
+ s4 enum('active', 'inactive', 'pending') default 'pending',
102
+ s5 enum('0', '1', '2'),
103
+ s6 enum('0', '1', '2') not null,
104
+ s7 enum('0', '1', '2') default '1',
105
+ s8 enum('0', '1', '2') default '0'
106
+ );
107
+
108
+ -- full index type
109
+ create table index_example (
110
+ id int auto_increment primary key,
111
+ name_lower varchar(100) not null,
112
+ name_inline varchar(100) not null,
113
+ email varchar(100) not null,
114
+ age int,
115
+ city varchar(50),
116
+ index idx_name (name_inline)
117
+ );
118
+
119
+ create index idx_name_lower on index_example ((lower(name_lower)));
120
+ create index idx_city_age on index_example (city, age);
121
+ create index idx_city_part on index_example (city(5));
122
+ create unique index idx_email_unique on index_example (email);
123
+
124
+ -- comments & hash index
125
+ create table hash_index_example (
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',
129
+ index idx_name_name1 (name, name1) using hash comment 'hash index for fast lookups on name and name1'
130
+ ) engine=memory comment='table for storing names with a hash index';
131
+
132
+ create table date_time_example (
133
+ default_now timestamp default localtime(),
134
+ default_local timestamp default now(),
135
+ date_plus_7_days date default (current_date() + interval 7 day),
136
+ date_minus_30_days date default (current_date - interval 30 day),
137
+ timestamp_plus_1_hour timestamp default (current_timestamp + interval 1 hour),
138
+ timestamp_minus_15_minutes timestamp default (current_timestamp - INTERVAL 15 minute),
139
+ on_update_1 datetime default now() on update now(),
140
+ on_update_2 datetime default now() on update localtime()
141
+ );
@@ -0,0 +1 @@
1
+ ✔ Generated DBML file from database's connection: schema.dbml
@@ -0,0 +1,252 @@
1
+ 2024-08-01T07:56:48.560Z
2
+ TypeError: _core.connector.fetch is not a function
3
+ at connectionHandler (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/connector.js:28:41)
4
+ at Object.db2dbml (/Users/huylm/code/dbx/dbml/packages/dbml-cli/lib/cli/index.js:35:26)
5
+ at Object.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-cli/bin/db2dbml.js:4:19)
6
+ at Module._compile (node:internal/modules/cjs/loader:1198:14)
7
+ at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
8
+ at Module.load (node:internal/modules/cjs/loader:1076:32)
9
+ at Function.Module._load (node:internal/modules/cjs/loader:911:12)
10
+ at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
11
+ at node:internal/main/run_main_module:22:47
12
+
13
+ 2024-08-01T07:57:28.334Z
14
+ error: password authentication failed for user "dbml"
15
+ at Parser.parseErrorMessage (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/parser.js:283:98)
16
+ at Parser.handlePacket (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/parser.js:122:29)
17
+ at Parser.parse (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/parser.js:35:38)
18
+ at Socket.<anonymous> (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/index.js:11:42)
19
+ at Socket.emit (node:events:513:28)
20
+ at addChunk (node:internal/streams/readable:315:12)
21
+ at readableAddChunk (node:internal/streams/readable:289:9)
22
+ at Socket.Readable.push (node:internal/streams/readable:228:10)
23
+ at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
24
+
25
+ 2024-08-06T10:36:39.493Z
26
+ Error: connect ECONNREFUSED 127.0.0.1:5432
27
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
28
+
29
+ 2024-08-06T10:39:55.684Z
30
+ Error: connect ECONNREFUSED 127.0.0.1:5432
31
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
32
+
33
+ 2024-08-06T10:40:09.774Z
34
+ Error: connect ECONNREFUSED 127.0.0.1:5432
35
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
36
+
37
+ 2024-08-06T10:46:40.738Z
38
+ Error: connect ECONNREFUSED 127.0.0.1:5432
39
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
40
+
41
+ 2024-08-06T10:47:23.247Z
42
+ Error: connect ECONNREFUSED 127.0.0.1:5432
43
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
44
+
45
+ 2024-08-06T11:32:55.326Z
46
+ Error: connect ECONNREFUSED 127.0.0.1:5432
47
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
48
+
49
+ 2024-08-06T11:33:52.691Z
50
+ Error: connect ECONNREFUSED 127.0.0.1:5432
51
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
52
+
53
+ 2024-08-06T11:46:50.111Z
54
+ Error: connect ECONNREFUSED 127.0.0.1:5432
55
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
56
+
57
+ 2024-08-06T13:45:33.216Z
58
+ Error: connect ECONNREFUSED 127.0.0.1:5432
59
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
60
+
61
+ 2024-08-06T14:03:51.715Z
62
+ Error: connect ECONNREFUSED 127.0.0.1:5432
63
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
64
+
65
+ 2024-08-06T14:20:00.051Z
66
+ Error: connect ECONNREFUSED 127.0.0.1:5432
67
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
68
+
69
+ 2024-08-06T14:24:52.652Z
70
+ Error: connect ECONNREFUSED 127.0.0.1:5432
71
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
72
+
73
+ 2024-08-06T14:26:39.541Z
74
+ Error: connect ECONNREFUSED 127.0.0.1:5432
75
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
76
+
77
+ 2024-08-06T14:32:52.720Z
78
+ Error: connect ECONNREFUSED 127.0.0.1:5432
79
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
80
+
81
+ 2024-08-06T14:33:20.897Z
82
+ Error: connect ECONNREFUSED 127.0.0.1:5432
83
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
84
+
85
+ 2024-08-06T15:03:45.397Z
86
+ Error: connect ECONNREFUSED 127.0.0.1:5432
87
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
88
+
89
+ 2024-08-06T15:04:36.505Z
90
+ Error: connect ECONNREFUSED 127.0.0.1:5432
91
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
92
+
93
+ 2024-08-06T16:16:07.427Z
94
+ Error: connect ECONNREFUSED 127.0.0.1:5432
95
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
96
+
97
+ 2024-08-06T16:18:52.991Z
98
+ Error: connect ECONNREFUSED 127.0.0.1:5432
99
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
100
+
101
+ 2024-08-06T16:19:20.829Z
102
+ Error: connect ECONNREFUSED 127.0.0.1:5432
103
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
104
+
105
+ 2024-08-06T16:20:10.607Z
106
+ Error: connect ECONNREFUSED 127.0.0.1:5432
107
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
108
+
109
+ 2024-08-07T03:34:45.150Z
110
+ Error: connect ECONNREFUSED 127.0.0.1:5432
111
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
112
+
113
+ 2024-08-07T03:35:44.244Z
114
+ Error: connect ECONNREFUSED 127.0.0.1:5432
115
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
116
+
117
+ 2024-08-07T03:59:27.920Z
118
+ Error: connect ECONNREFUSED 127.0.0.1:5432
119
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
120
+
121
+ 2024-08-07T04:03:38.191Z
122
+ Error: connect ECONNREFUSED 127.0.0.1:5432
123
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
124
+
125
+ 2024-08-07T04:04:50.060Z
126
+ Error: connect ECONNREFUSED 127.0.0.1:5432
127
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
128
+
129
+ 2024-08-07T04:07:17.932Z
130
+ Error: connect ECONNREFUSED 127.0.0.1:5432
131
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
132
+
133
+ 2024-08-07T04:43:56.192Z
134
+ Error: connect ECONNREFUSED 127.0.0.1:5432
135
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
136
+
137
+ 2024-08-07T04:45:05.535Z
138
+ Error: connect ECONNREFUSED 127.0.0.1:5432
139
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
140
+
141
+ 2024-08-07T04:50:20.315Z
142
+ Error: connect ECONNREFUSED 127.0.0.1:5432
143
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
144
+
145
+ 2024-08-07T04:51:13.784Z
146
+ Error: connect ECONNREFUSED 127.0.0.1:5432
147
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
148
+
149
+ 2024-08-07T04:51:28.624Z
150
+ Error: connect ECONNREFUSED 127.0.0.1:5432
151
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
152
+
153
+ 2024-08-07T04:55:29.993Z
154
+ Error: connect ECONNREFUSED 127.0.0.1:5432
155
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
156
+
157
+ 2024-08-07T04:55:51.718Z
158
+ Error: connect ECONNREFUSED 127.0.0.1:5432
159
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
160
+
161
+ 2024-08-07T05:13:29.088Z
162
+ Error: connect ECONNREFUSED 127.0.0.1:5432
163
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
164
+
165
+ 2024-08-07T05:18:01.681Z
166
+ Error: connect ECONNREFUSED 127.0.0.1:5432
167
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
168
+
169
+ 2024-08-07T05:18:39.927Z
170
+ Error: connect ECONNREFUSED 127.0.0.1:5432
171
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
172
+
173
+ 2024-08-07T05:19:30.587Z
174
+ Error: connect ECONNREFUSED 127.0.0.1:5432
175
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
176
+
177
+ 2024-08-07T05:19:57.969Z
178
+ Error: connect ECONNREFUSED 127.0.0.1:5432
179
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
180
+
181
+ 2024-08-07T05:26:02.292Z
182
+ Error: connect ECONNREFUSED 127.0.0.1:5432
183
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
184
+
185
+ 2024-08-07T05:26:37.720Z
186
+ Error: connect ECONNREFUSED 127.0.0.1:5432
187
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
188
+
189
+ 2024-08-07T05:26:49.081Z
190
+ Error: connect ECONNREFUSED 127.0.0.1:5432
191
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
192
+
193
+ 2024-08-07T07:30:55.870Z
194
+ Error: connect ECONNREFUSED 127.0.0.1:5432
195
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
196
+
197
+ 2024-08-07T07:33:22.561Z
198
+ Error: connect ECONNREFUSED 127.0.0.1:5432
199
+ at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
200
+
201
+ 2024-08-07T08:00:27.430Z
202
+ error: password authentication failed for user "dbml"
203
+ at Parser.parseErrorMessage (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/parser.js:283:98)
204
+ at Parser.handlePacket (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/parser.js:122:29)
205
+ at Parser.parse (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/parser.js:35:38)
206
+ at Socket.<anonymous> (/Users/huylm/code/dbx/dbml/node_modules/pg-protocol/dist/index.js:11:42)
207
+ at Socket.emit (node:events:513:28)
208
+ at addChunk (node:internal/streams/readable:315:12)
209
+ at readableAddChunk (node:internal/streams/readable:289:9)
210
+ at Socket.Readable.push (node:internal/streams/readable:228:10)
211
+ at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
212
+
213
+ 2024-08-09T00:33:48.829Z
214
+ Error: TypeError: Cannot read properties of undefined (reading 'map')
215
+ at generateDatabase (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/databaseGenerator.js:116:11)
216
+ at _callee$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:34:62)
217
+ at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:13:1357)
218
+ at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:13:4174)
219
+ at Generator.next (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:13:2208)
220
+ at asyncGeneratorStep (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:14:103)
221
+ at _next (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:15:194)
222
+ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
223
+
224
+ 2024-08-09T00:35:22.283Z
225
+ Error: TypeError: Cannot read properties of undefined (reading 'map')
226
+ at generateDatabase (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/parse/databaseGenerator.js:116:11)
227
+ at _callee$ (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:34:62)
228
+ at tryCatch (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:13:1357)
229
+ at Generator.<anonymous> (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:13:4174)
230
+ at Generator.next (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:13:2208)
231
+ at asyncGeneratorStep (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:14:103)
232
+ at _next (/Users/huylm/code/dbx/dbml/packages/dbml-core/lib/import/index.js:15:194)
233
+ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
234
+
235
+ 2024-08-10T10:33:37.536Z
236
+ undefined
237
+
238
+ 2024-08-10T14:22:55.420Z
239
+ undefined
240
+
241
+ 2024-08-10T14:24:22.216Z
242
+ undefined
243
+
244
+ 2024-08-10T14:26:51.045Z
245
+ undefined
246
+
247
+ 2024-08-10T14:28:05.965Z
248
+ undefined
249
+
250
+ 2024-08-10T14:43:52.134Z
251
+ undefined
252
+
@@ -0,0 +1,140 @@
1
+ Enum "gender_type" {
2
+ "Male"
3
+ "Female"
4
+ "Other"
5
+ }
6
+
7
+ Table "all_default_values" {
8
+ "id" int4 [pk, not null, increment]
9
+ "boolean_col" bool [default: true]
10
+ "integer_col" int4 [default: 42]
11
+ "numeric_col" numeric(10,2) [default: 99.99]
12
+ "date_col" date [default: `CURRENT_DATE`]
13
+ "date_col_specific" date [default: '2024-01-01']
14
+ "timestamp_col" timestamp [default: `CURRENT_TIMESTAMP`]
15
+ "timestamp_col_specific" timestamp [default: '2024-01-01 12:00:00']
16
+ "date_plus_7_days" date [default: `(CURRENT_DATE + '7 days'::interval)`]
17
+ "date_minus_30_days" date [default: `(CURRENT_DATE - '30 days'::interval)`]
18
+ "timestamp_plus_1_hour" timestamp [default: `(CURRENT_TIMESTAMP + '01:00:00'::interval)`]
19
+ "timestamp_minus_15_minutes" timestamp [default: `(CURRENT_TIMESTAMP - '00:15:00'::interval)`]
20
+ }
21
+
22
+ Table "all_string_types" {
23
+ "text_col" text [default: 'default_text']
24
+ "varchar_col" varchar(100) [default: 'default_varchar']
25
+ "char_col" bpchar(10) [default: 'default_char']
26
+ "character_varying_col" varchar(50) [default: 'default_character_varying']
27
+ "character_col" bpchar(5) [default: 'default_character']
28
+ "name_col" name [default: 'default_name']
29
+ "bpchar_col" bpchar(15) [default: 'default_bpchar']
30
+ "text_array_col" "text[]" [default: `ARRAY['default_text1', 'default_text2']`]
31
+ "json_col" json [default: `{"default_key": "default_value"}`]
32
+ "jsonb_col" jsonb [default: `{"default_key": "default_value"}`]
33
+ }
34
+
35
+ Table "authors" {
36
+ "authorid" int4 [not null, increment]
37
+ "nationalityid" int4 [not null]
38
+ "authorname" varchar(100)
39
+ "birthyear" int4
40
+
41
+ Indexes {
42
+ (authorid, nationalityid) [type: btree, name: "authors_pkey"]
43
+ }
44
+ }
45
+
46
+ Table "books" {
47
+ "bookid" int4 [pk, not null, increment]
48
+ "authorid" int4
49
+ "nationalityid" int4
50
+ "isbn" varchar(20) [unique]
51
+ "title" varchar(200)
52
+ }
53
+
54
+ Table "order_items" {
55
+ "order_item_id" int4 [pk, not null, increment]
56
+ "order_id" int4 [not null]
57
+ "product_id" int4 [not null]
58
+ "quantity" int4 [not null]
59
+ "unit_price" numeric(10,2) [not null]
60
+
61
+ Indexes {
62
+ (order_id, product_id) [type: btree, name: "uq_order_product"]
63
+ (order_id, product_id) [type: btree, name: "idx_order_items_order_product"]
64
+ }
65
+ }
66
+
67
+ Table "orders" {
68
+ "order_id" int4 [pk, not null, increment]
69
+ "user_id" int4 [not null]
70
+ "order_date" timestamptz [default: `CURRENT_TIMESTAMP`]
71
+ "total_amount" numeric(12,2) [not null]
72
+ "status" varchar(20) [default: 'pending']
73
+ "shipping_address" text [not null]
74
+ "billing_address" text [not null]
75
+
76
+ Indexes {
77
+ (user_id, order_date) [type: btree, name: "idx_orders_user_date"]
78
+ }
79
+ }
80
+
81
+ Table "products" {
82
+ "product_id" int4 [pk, not null, increment]
83
+ "name" varchar(100) [not null]
84
+ "description" text
85
+ "price" numeric(10,2) [not null]
86
+ "stock_quantity" int4 [not null, default: 0]
87
+ "category" varchar(50)
88
+ "created_at" timestamptz [default: `CURRENT_TIMESTAMP`]
89
+ "updated_at" timestamptz [default: `CURRENT_TIMESTAMP`]
90
+ "is_available" bool [default: true]
91
+
92
+ Indexes {
93
+ category [type: btree, name: "idx_products_category"]
94
+ }
95
+ }
96
+
97
+ Table "table_with_comments" {
98
+ "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.']
101
+ "created_at" timestamptz [default: `CURRENT_TIMESTAMP`, note: 'Timestamp when the item was created.']
102
+ Note: 'This table stores information about various items.'
103
+ }
104
+
105
+ Table "user_define_data_types" {
106
+ "id" int4 [pk, not null, increment]
107
+ "name" varchar(50)
108
+ "gender" gender_type
109
+ "age" int4range
110
+ "height" float8
111
+ "weight" float8
112
+ }
113
+
114
+ Table "users" {
115
+ "user_id" int4 [pk, not null, increment]
116
+ "username" varchar(50) [unique, not null]
117
+ "email" varchar(100) [unique, not null]
118
+ "password_hash" varchar(255) [not null]
119
+ "first_name" varchar(50)
120
+ "last_name" varchar(50)
121
+ "full_name" varchar(100)
122
+ "date_of_birth" date
123
+ "created_at" timestamptz [default: `CURRENT_TIMESTAMP`]
124
+ "last_login" timestamptz
125
+ "is_active" bool [default: true]
126
+
127
+ Indexes {
128
+ full_name [type: btree, name: "User Name"]
129
+ email [type: btree, name: "idx_users_email"]
130
+ (is_active, `lower((full_name)::text)`) [type: btree, name: "users_is_active_lower_idx"]
131
+ }
132
+ }
133
+
134
+ Ref "fk_authornationality":"authors".("authorid", "nationalityid") < "books".("authorid", "nationalityid") [delete: cascade]
135
+
136
+ Ref "fk_order":"orders"."order_id" < "order_items"."order_id" [delete: cascade]
137
+
138
+ Ref "fk_product":"products"."product_id" < "order_items"."product_id" [delete: cascade]
139
+
140
+ Ref "fk_user":"users"."user_id" < "orders"."user_id" [delete: cascade]
@@ -0,0 +1,8 @@
1
+ {
2
+ "args": [
3
+ "postgres",
4
+ "postgresql://dbml:testtest@localhost:5432/dbml_test",
5
+ "-o",
6
+ "./out-files/schema.dbml"
7
+ ]
8
+ }
@@ -0,0 +1,140 @@
1
+ Enum "gender_type" {
2
+ "Male"
3
+ "Female"
4
+ "Other"
5
+ }
6
+
7
+ Table "all_default_values" {
8
+ "id" int4 [pk, not null, increment]
9
+ "boolean_col" bool [default: true]
10
+ "integer_col" int4 [default: 42]
11
+ "numeric_col" numeric(10,2) [default: 99.99]
12
+ "date_col" date [default: `CURRENT_DATE`]
13
+ "date_col_specific" date [default: '2024-01-01']
14
+ "timestamp_col" timestamp [default: `CURRENT_TIMESTAMP`]
15
+ "timestamp_col_specific" timestamp [default: '2024-01-01 12:00:00']
16
+ "date_plus_7_days" date [default: `(CURRENT_DATE + '7 days'::interval)`]
17
+ "date_minus_30_days" date [default: `(CURRENT_DATE - '30 days'::interval)`]
18
+ "timestamp_plus_1_hour" timestamp [default: `(CURRENT_TIMESTAMP + '01:00:00'::interval)`]
19
+ "timestamp_minus_15_minutes" timestamp [default: `(CURRENT_TIMESTAMP - '00:15:00'::interval)`]
20
+ }
21
+
22
+ Table "all_string_types" {
23
+ "text_col" text [default: 'default_text']
24
+ "varchar_col" varchar(100) [default: 'default_varchar']
25
+ "char_col" bpchar(10) [default: 'default_char']
26
+ "character_varying_col" varchar(50) [default: 'default_character_varying']
27
+ "character_col" bpchar(5) [default: 'default_character']
28
+ "name_col" name [default: 'default_name']
29
+ "bpchar_col" bpchar(15) [default: 'default_bpchar']
30
+ "text_array_col" "text[]" [default: `ARRAY['default_text1', 'default_text2']`]
31
+ "json_col" json [default: `{"default_key": "default_value"}`]
32
+ "jsonb_col" jsonb [default: `{"default_key": "default_value"}`]
33
+ }
34
+
35
+ Table "authors" {
36
+ "authorid" int4 [not null, increment]
37
+ "nationalityid" int4 [not null]
38
+ "authorname" varchar(100)
39
+ "birthyear" int4
40
+
41
+ Indexes {
42
+ (authorid, nationalityid) [type: btree, name: "authors_pkey"]
43
+ }
44
+ }
45
+
46
+ Table "books" {
47
+ "bookid" int4 [pk, not null, increment]
48
+ "authorid" int4
49
+ "nationalityid" int4
50
+ "isbn" varchar(20) [unique]
51
+ "title" varchar(200)
52
+ }
53
+
54
+ Table "order_items" {
55
+ "order_item_id" int4 [pk, not null, increment]
56
+ "order_id" int4 [not null]
57
+ "product_id" int4 [not null]
58
+ "quantity" int4 [not null]
59
+ "unit_price" numeric(10,2) [not null]
60
+
61
+ Indexes {
62
+ (order_id, product_id) [type: btree, name: "uq_order_product"]
63
+ (order_id, product_id) [type: btree, name: "idx_order_items_order_product"]
64
+ }
65
+ }
66
+
67
+ Table "orders" {
68
+ "order_id" int4 [pk, not null, increment]
69
+ "user_id" int4 [not null]
70
+ "order_date" timestamptz [default: `CURRENT_TIMESTAMP`]
71
+ "total_amount" numeric(12,2) [not null]
72
+ "status" varchar(20) [default: 'pending']
73
+ "shipping_address" text [not null]
74
+ "billing_address" text [not null]
75
+
76
+ Indexes {
77
+ (user_id, order_date) [type: btree, name: "idx_orders_user_date"]
78
+ }
79
+ }
80
+
81
+ Table "products" {
82
+ "product_id" int4 [pk, not null, increment]
83
+ "name" varchar(100) [not null]
84
+ "description" text
85
+ "price" numeric(10,2) [not null]
86
+ "stock_quantity" int4 [not null, default: 0]
87
+ "category" varchar(50)
88
+ "created_at" timestamptz [default: `CURRENT_TIMESTAMP`]
89
+ "updated_at" timestamptz [default: `CURRENT_TIMESTAMP`]
90
+ "is_available" bool [default: true]
91
+
92
+ Indexes {
93
+ category [type: btree, name: "idx_products_category"]
94
+ }
95
+ }
96
+
97
+ Table "table_with_comments" {
98
+ "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.']
101
+ "created_at" timestamptz [default: `CURRENT_TIMESTAMP`, note: 'Timestamp when the item was created.']
102
+ Note: 'This table stores information about various items.'
103
+ }
104
+
105
+ Table "user_define_data_types" {
106
+ "id" int4 [pk, not null, increment]
107
+ "name" varchar(50)
108
+ "gender" gender_type
109
+ "age" int4range
110
+ "height" float8
111
+ "weight" float8
112
+ }
113
+
114
+ Table "users" {
115
+ "user_id" int4 [pk, not null, increment]
116
+ "username" varchar(50) [unique, not null]
117
+ "email" varchar(100) [unique, not null]
118
+ "password_hash" varchar(255) [not null]
119
+ "first_name" varchar(50)
120
+ "last_name" varchar(50)
121
+ "full_name" varchar(100)
122
+ "date_of_birth" date
123
+ "created_at" timestamptz [default: `CURRENT_TIMESTAMP`]
124
+ "last_login" timestamptz
125
+ "is_active" bool [default: true]
126
+
127
+ Indexes {
128
+ full_name [type: btree, name: "User Name"]
129
+ email [type: btree, name: "idx_users_email"]
130
+ (is_active, `lower((full_name)::text)`) [type: btree, name: "users_is_active_lower_idx"]
131
+ }
132
+ }
133
+
134
+ Ref "fk_authornationality":"authors".("authorid", "nationalityid") < "books".("authorid", "nationalityid") [delete: cascade]
135
+
136
+ Ref "fk_order":"orders"."order_id" < "order_items"."order_id" [delete: cascade]
137
+
138
+ Ref "fk_product":"products"."product_id" < "order_items"."product_id" [delete: cascade]
139
+
140
+ Ref "fk_user":"users"."user_id" < "orders"."user_id" [delete: cascade]