Browse Source

feat: redesign databae type extension (#124)

* feat: update frontend resources

* feat: redesign database type extension

* fix: ut failed

* fix: ut failed
master
vran 3 years ago
committed by GitHub
parent
commit
409bae9dc6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      api/src/main/resources/static/css/144.82a2f213.css
  2. 1
      api/src/main/resources/static/css/238.06c68835.css
  3. 0
      api/src/main/resources/static/css/656.a8ab2b3e.css
  4. 0
      api/src/main/resources/static/css/695.a8ab2b3e.css
  5. 0
      api/src/main/resources/static/css/858.06c68835.css
  6. 0
      api/src/main/resources/static/css/899.b144be0e.css
  7. 1
      api/src/main/resources/static/css/968.82a2f213.css
  8. 15
      api/src/main/resources/static/img/MariaDB.9e6854cc.svg
  9. 1
      api/src/main/resources/static/img/Oracle.c9ed26e0.svg
  10. 1
      api/src/main/resources/static/img/Sqlserver.deff7c4c.svg
  11. 2
      api/src/main/resources/static/index.html
  12. 2
      api/src/main/resources/static/js/130-legacy.c0c10138.js
  13. 1
      api/src/main/resources/static/js/130-legacy.c0c10138.js.map
  14. 2
      api/src/main/resources/static/js/144-legacy.ba5cd34f.js
  15. 1
      api/src/main/resources/static/js/144-legacy.ba5cd34f.js.map
  16. 2
      api/src/main/resources/static/js/144.92d00293.js
  17. 1
      api/src/main/resources/static/js/144.92d00293.js.map
  18. 2
      api/src/main/resources/static/js/227-legacy.0a01c860.js
  19. 1
      api/src/main/resources/static/js/227-legacy.0a01c860.js.map
  20. 2
      api/src/main/resources/static/js/227-legacy.865716b5.js
  21. 1
      api/src/main/resources/static/js/227-legacy.865716b5.js.map
  22. 2
      api/src/main/resources/static/js/227.a17c6fc4.js
  23. 1
      api/src/main/resources/static/js/227.a17c6fc4.js.map
  24. 2
      api/src/main/resources/static/js/227.fbdad7cc.js
  25. 1
      api/src/main/resources/static/js/227.fbdad7cc.js.map
  26. 2
      api/src/main/resources/static/js/238.b5edc585.js
  27. 1
      api/src/main/resources/static/js/238.b5edc585.js.map
  28. 4
      api/src/main/resources/static/js/269-legacy.af28be5f.js
  29. 2
      api/src/main/resources/static/js/269-legacy.af28be5f.js.map
  30. 33
      api/src/main/resources/static/js/269-legacy.c0d9c277.js
  31. 1
      api/src/main/resources/static/js/269-legacy.c0d9c277.js.map
  32. 33
      api/src/main/resources/static/js/286.4dfbd2bf.js
  33. 1
      api/src/main/resources/static/js/286.4dfbd2bf.js.map
  34. 2
      api/src/main/resources/static/js/295-legacy.0c0c35b8.js
  35. 1
      api/src/main/resources/static/js/295-legacy.0c0c35b8.js.map
  36. 2
      api/src/main/resources/static/js/295.299a1114.js
  37. 1
      api/src/main/resources/static/js/295.299a1114.js.map
  38. 2
      api/src/main/resources/static/js/393-legacy.a6131e23.js
  39. 1
      api/src/main/resources/static/js/393-legacy.a6131e23.js.map
  40. 2
      api/src/main/resources/static/js/393.c729b5a6.js
  41. 1
      api/src/main/resources/static/js/393.c729b5a6.js.map
  42. 4
      api/src/main/resources/static/js/469-legacy.9029bf4c.js
  43. 2
      api/src/main/resources/static/js/469-legacy.9029bf4c.js.map
  44. 2
      api/src/main/resources/static/js/469-legacy.e74a784c.js
  45. 1
      api/src/main/resources/static/js/469-legacy.e74a784c.js.map
  46. 33
      api/src/main/resources/static/js/656.0ec06236.js
  47. 1
      api/src/main/resources/static/js/656.0ec06236.js.map
  48. 33
      api/src/main/resources/static/js/695-legacy.cb00cc3f.js
  49. 1
      api/src/main/resources/static/js/695-legacy.cb00cc3f.js.map
  50. 2
      api/src/main/resources/static/js/850-legacy.f921a728.js
  51. 1
      api/src/main/resources/static/js/850-legacy.f921a728.js.map
  52. 2
      api/src/main/resources/static/js/850.e3199b2f.js
  53. 1
      api/src/main/resources/static/js/850.e3199b2f.js.map
  54. 2
      api/src/main/resources/static/js/858-legacy.470bc5ce.js
  55. 1
      api/src/main/resources/static/js/858-legacy.470bc5ce.js.map
  56. 2
      api/src/main/resources/static/js/858.372a44ff.js
  57. 1
      api/src/main/resources/static/js/858.372a44ff.js.map
  58. 2
      api/src/main/resources/static/js/899-legacy.c2da2b56.js
  59. 1
      api/src/main/resources/static/js/899-legacy.c2da2b56.js.map
  60. 2
      api/src/main/resources/static/js/899.6523d40b.js
  61. 1
      api/src/main/resources/static/js/899.6523d40b.js.map
  62. 2
      api/src/main/resources/static/js/968.8a1eeafd.js
  63. 1
      api/src/main/resources/static/js/968.8a1eeafd.js.map
  64. 2
      api/src/main/resources/static/js/app-legacy.b2808186.js
  65. 1
      api/src/main/resources/static/js/app-legacy.b2808186.js.map
  66. 2
      api/src/main/resources/static/js/app-legacy.ebb10190.js
  67. 1
      api/src/main/resources/static/js/app-legacy.ebb10190.js.map
  68. 2
      api/src/main/resources/static/js/app.6b8dcbe2.js
  69. 1
      api/src/main/resources/static/js/app.6b8dcbe2.js.map
  70. 2
      api/src/main/resources/static/js/app.e6e2e76f.js
  71. 1
      api/src/main/resources/static/js/app.e6e2e76f.js.map
  72. 4
      core/src/main/java/com/databasir/core/domain/database/converter/DatabaseTypePojoConverter.java
  73. 2
      core/src/main/java/com/databasir/core/domain/database/data/DatabaseTypeDetailResponse.java
  74. 2
      core/src/main/java/com/databasir/core/domain/database/data/DatabaseTypePageResponse.java
  75. 2
      core/src/main/java/com/databasir/core/domain/database/data/DatabaseTypeSimpleResponse.java
  76. 36
      core/src/main/java/com/databasir/core/domain/database/service/DatabaseTypeService.java
  77. 14
      core/src/main/java/com/databasir/core/domain/document/service/DocumentService.java
  78. 16
      core/src/main/java/com/databasir/core/infrastructure/connection/CustomDatabaseConnectionFactory.java
  79. 135
      core/src/main/java/com/databasir/core/infrastructure/driver/DriverResources.java
  80. 18
      core/src/main/java/com/databasir/core/infrastructure/driver/DriverResult.java
  81. 6
      core/src/test/java/com/databasir/core/domain/database/service/DatabaseTypeServiceTest.java
  82. 13
      dao/generated-src/jooq/main/java/com/databasir/dao/tables/DatabaseType.java
  83. 19
      dao/generated-src/jooq/main/java/com/databasir/dao/tables/pojos/DatabaseTypePojo.java
  84. 139
      dao/generated-src/jooq/main/java/com/databasir/dao/tables/records/DatabaseTypeRecord.java
  85. 8
      dao/src/main/java/com/databasir/dao/impl/DatabaseTypeDao.java
  86. 380
      dao/src/main/resources/db/init/init.sql
  87. 2
      dao/src/main/resources/db/migration/V1.4.1__driver_file.sql
  88. 2
      databasir-frontend

0
api/src/main/resources/static/css/469.82a2f213.css → api/src/main/resources/static/css/144.82a2f213.css

1
api/src/main/resources/static/css/238.06c68835.css

File diff suppressed because one or more lines are too long

0
api/src/main/resources/static/css/269.a8ab2b3e.css → api/src/main/resources/static/css/656.a8ab2b3e.css

0
api/src/main/resources/static/css/286.a8ab2b3e.css → api/src/main/resources/static/css/695.a8ab2b3e.css

0
api/src/main/resources/static/css/130.06c68835.css → api/src/main/resources/static/css/858.06c68835.css

0
api/src/main/resources/static/css/295.b144be0e.css → api/src/main/resources/static/css/899.b144be0e.css

1
api/src/main/resources/static/css/968.82a2f213.css

@ -1 +0,0 @@
.el-row{margin-top:33px}

15
api/src/main/resources/static/img/MariaDB.9e6854cc.svg

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 789.1 195.64" height="48">
<defs>
<style>.cls-1{fill:#003545;}</style>
</defs>
<title>MDB-HLogo_RGB</title>
<path class="cls-1" d="M378.08,70l18.52,71.5h-14L370.26,90l-23.17,51.5H335.3l-23.07-51.2-12.68,51.2H285.89L304.21,70h12.08l24.95,55.36L366.1,70Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M449.27,97.64V89.32h13.47v52.19H449.27v-8.42c-3.56,6-10.89,9.51-19.8,9.51-18.62,0-29-13.08-29-28.23,0-14.55,9.9-26.24,27-26.24C437.29,88.13,445.41,91.5,449.27,97.64Zm-34.46,17.43c0,9.6,6,17.82,17.72,17.82,11.29,0,17.43-8,17.43-17.53s-6.33-17.62-18-17.62C420.65,97.74,414.81,105.86,414.81,115.07Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M493.13,141.51H479.66V89.32h13.47V101c3.56-8,10.79-12.87,18.81-12.87a24.2,24.2,0,0,1,8.42,1.39l-2.87,9.9a29.66,29.66,0,0,0-7.13-1c-9.71,0-17.23,7.33-17.23,18.12Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M527.09,75.55a6.86,6.86,0,0,1,7.23-7,7.1,7.1,0,0,1,7.33,7.23c0,3.47-2.38,6.93-7.33,6.93A6.93,6.93,0,0,1,527.09,75.55Zm.59,13.77h13.47v38.13c0,2.37.5,4.06,2.48,4.06a14.37,14.37,0,0,0,2.57-.3l2.08,9.8a23.72,23.72,0,0,1-8.91,1.59c-5.65,0-11.69-1.69-11.69-14.46Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M601.36,97.64V89.32h13.46v52.19H601.36v-8.42c-3.57,6-10.9,9.51-19.81,9.51-18.62,0-29-13.08-29-28.23,0-14.55,9.91-26.24,27-26.24C589.37,88.13,597.49,91.5,601.36,97.64Zm-34.47,17.43c0,9.6,6,17.82,17.73,17.82,11.29,0,17.43-8,17.43-17.53s-6.34-17.62-18-17.62C572.74,97.74,566.89,105.86,566.89,115.07Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M635.51,70H667.8c27.13,0,40.7,14.95,40.5,35.75.2,21.59-14.76,35.75-38.13,35.75H635.51Zm8.91,6.34v58.92H669c21.59,0,29.81-14.56,29.81-29.71,0-17.13-10.3-29.21-29.81-29.21Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M763.35,141.51h-41V70h36.94c14.16,0,27.63,2.67,27.43,18.52,0,11.19-6.93,14.26-14.26,15.45,10.4.89,16.64,7.52,16.64,18.22C789.19,138.24,775.13,141.51,763.35,141.51Zm-3.07-40.31c14.16,0,17.33-5.44,17.33-12.38,0-10.39-6.34-12.77-17.33-12.77H730.87V101.2Zm.39,6h-29.8v28.23H762c8.72,0,17.93-2.88,17.93-13.87C779.89,108.93,769.29,107.24,760.67,107.24Z" transform="translate(0 -3.38)"></path>
<path class="cls-1" d="M299.2,4.34a4.35,4.35,0,0,0-2.92-1c-2.9,0-6.65,2-8.66,3-.35.19-.62.33-.81.41A27.32,27.32,0,0,1,276,9.53c-3.86.12-7.19.35-11.5.8C238.82,13,227.43,32.6,216.42,51.6c-6,10.32-12.18,21-20.67,29.28a54.92,54.92,0,0,1-5.59,4.74c-8.78,6.54-19.81,11.17-28.43,14.47-8.26,3.15-17.28,6-26,8.74-8,2.51-15.51,4.89-22.44,7.46-3.13,1.16-5.79,2-8.13,2.83-6.31,2.1-10.87,3.62-17.51,8.17-2.59,1.77-5.19,3.69-7,5.14A73.46,73.46,0,0,0,66.8,147.05a86.62,86.62,0,0,1-11.6,14c-1.4,1.37-3.89,2-7.62,2-4.37,0-9.67-.9-15.28-1.85-5.77-1-11.75-2-16.87-2-4.17,0-7.35.67-9.74,2.06,0,0-4,2.34-5.69,5.36l1.66.75a34.71,34.71,0,0,1,7.1,5.07,35.39,35.39,0,0,0,7.37,5.25,6.61,6.61,0,0,1,2.27,1.51c-.7,1-1.73,2.35-2.8,3.76-5.92,7.74-9.37,12.63-7.39,15.29a6.09,6.09,0,0,0,3,.71c12.9,0,19.82-3.36,28.59-7.6,2.54-1.23,5.16-2.5,8.16-3.8,5.12-2.22,10.64-5.76,16.48-9.52,7.74-5,15.74-10.11,23.49-12.6a64,64,0,0,1,19.71-2.77c8.23,0,16.83,1.1,25.15,2.17,6.21.79,12.63,1.61,18.93,2,2.45.15,4.72.22,6.92.22a77.2,77.2,0,0,0,8.83-.47l.7-.24c4.42-2.72,6.49-8.55,8.5-14.18,1.29-3.63,2.37-6.89,4.05-9a2.79,2.79,0,0,1,.34-.28.4.4,0,0,1,.5.09s0,.05,0,.15c-1.06,22.06-9.9,36.05-18.88,48.49l-6,6.43s8.39,0,13.16-1.84c17.42-5.21,30.58-16.69,40.15-35a149.42,149.42,0,0,0,6.32-14.44c.16-.41,1.68-1.17,1.53.95,0,.63-.09,1.32-.14,2h0c0,.43-.06.87-.08,1.31-.25,3-1,9.57-1,9.57l5.38-2.88c13-8.22,23-24.74,30.56-50.47,3.16-10.72,5.47-21.37,7.51-30.76,2.44-11.23,4.55-20.93,7-24.68,3.78-5.89,9.55-9.87,15.13-13.73l2.28-1.58c7-4.93,14-10.62,15.54-21.22l0-.24C301.22,7.29,300.27,5.27,299.2,4.34Z" transform="translate(0 -3.38)"></path>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

1
api/src/main/resources/static/img/Oracle.c9ed26e0.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1650692654847" class="icon" viewBox="0 0 8165 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="988" xmlns:xlink="http://www.w3.org/1999/xlink" width="255.15625" height="48"><defs><style type="text/css"></style></defs><path d="M3398.499037 666.115306h520.24153l-274.800972-442.904953-504.499351 800.60224-229.885787 0.187407 614.069914-961.397353A143.303803 143.303803 0 0 1 3643.564782 0.008746c48.350978 0 92.703942 22.801172 118.878438 60.907239l616.193859 963.084015-230.073194-0.187407-107.883901-178.973581h-527.175585l-114.942893-178.723706z m2386.751699 178.911113V10.00378h-195.090574v916.669574c0 25.362399 10.307379 49.600357 28.423379 67.716357 19.115503 18.928096 44.352964 29.360413 71.464494 29.360413h888.995824l114.693017-178.661236H5785.250736z m-3225.2726-149.425762a342.829673 342.829673 0 0 0 0-685.596877H1706.777029v1013.808813h194.903167V188.665016h644.867113a163.856092 163.856092 0 0 1 164.043499 164.105968 163.98103 163.98103 0 0 1-164.043499 164.168437l-549.414537-0.187407 581.77346 507.060579h283.234282l-391.430527-328.399343 89.268149 0.187407zM506.935641 1023.812593a506.873172 506.873172 0 1 1 0-1013.808813h589.269735a506.935641 506.935641 0 0 1 506.873173 506.935641 506.935641 506.935641 0 0 1-506.873173 507.060579l-589.269735-0.187407z m576.151253-178.661236a328.086998 328.086998 0 0 0 328.149467-328.211936 328.086998 328.086998 0 0 0-328.149467-328.211936H519.991655a328.274405 328.274405 0 0 0 0 656.423872h563.095239z m3702.285608 178.661236a506.935641 506.935641 0 1 1 0-1013.808813h700.277084l-114.755487 178.723705h-572.340646a328.274405 328.274405 0 1 0 0 656.423872h702.838312l-114.505611 178.661236h-601.576121z m2384.752692-178.661236a328.086998 328.086998 0 0 1-315.593205-238.506504h833.335977l114.755486-178.723705-948.341339-0.062469a328.211936 328.211936 0 0 1 315.843081-239.193663l572.028302 0.062469 114.942893-178.723705h-700.277084a506.935641 506.935641 0 0 0 0 1013.808813h601.576121l114.505611-178.661236h-702.775843zM7961.482027 117.950149a89.455556 89.455556 0 1 1 179.036051 0 89.455556 89.455556 0 1 1-179.036051 0z m89.580494 114.318204l0 0z m-10.744661-181.597278c17.553779 0 24.800179 0.187407 33.420895 3.435793 22.488827 7.558745 24.800179 28.235972 24.800179 35.794717a49.975171 49.975171 0 0 1-1.374317 10.494785 34.795213 34.795213 0 0 1-15.867117 21.926607c-1.311848 0.999503-2.061476 1.624193-5.747145 2.99851l29.672758 53.098619h-28.673254l-25.987089-48.850729h-17.303903v48.78826h-24.987586V50.671075h32.046579z m8.933061 57.721323c7.683683-0.124938 16.241931-0.687159 21.239448-7.996028a18.990565 18.990565 0 0 0 2.873572-10.932068 16.86662 16.86662 0 0 0-9.62022-15.492303c-5.747145-2.248883-11.619227-2.248883-23.425861-2.248883h-7.058993v36.669282h15.992054z" fill="#d81e06" p-id="989"></path></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

1
api/src/main/resources/static/img/Sqlserver.deff7c4c.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

2
api/src/main/resources/static/index.html

@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir</title><script defer="defer" type="module" src="/js/chunk-vendors.9effab81.js"></script><script defer="defer" type="module" src="/js/app.e6e2e76f.js"></script><link href="/css/chunk-vendors.81898547.css" rel="stylesheet"><link href="/css/app.15b40a89.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.fb0c8458.js" nomodule></script><script defer="defer" src="/js/app-legacy.ebb10190.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir</title><script defer="defer" type="module" src="/js/chunk-vendors.9effab81.js"></script><script defer="defer" type="module" src="/js/app.6b8dcbe2.js"></script><link href="/css/chunk-vendors.81898547.css" rel="stylesheet"><link href="/css/app.15b40a89.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.fb0c8458.js" nomodule></script><script defer="defer" src="/js/app-legacy.b2808186.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

2
api/src/main/resources/static/js/130-legacy.c0c10138.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/130-legacy.c0c10138.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/144-legacy.ba5cd34f.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/144-legacy.ba5cd34f.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/144.92d00293.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/144.92d00293.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/227-legacy.0a01c860.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/227-legacy.0a01c860.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/227-legacy.865716b5.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/227-legacy.865716b5.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/227.a17c6fc4.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/227.a17c6fc4.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/227.fbdad7cc.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/227.fbdad7cc.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/238.b5edc585.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/238.b5edc585.js.map

File diff suppressed because one or more lines are too long

4
api/src/main/resources/static/js/680-legacy.57be8abc.js → api/src/main/resources/static/js/269-legacy.af28be5f.js

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/680-legacy.57be8abc.js.map → api/src/main/resources/static/js/269-legacy.af28be5f.js.map

File diff suppressed because one or more lines are too long

33
api/src/main/resources/static/js/269-legacy.c0d9c277.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/269-legacy.c0d9c277.js.map

File diff suppressed because one or more lines are too long

33
api/src/main/resources/static/js/286.4dfbd2bf.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/286.4dfbd2bf.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/295-legacy.0c0c35b8.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/295-legacy.0c0c35b8.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/295.299a1114.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/295.299a1114.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/393-legacy.a6131e23.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/393-legacy.a6131e23.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/393.c729b5a6.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/393.c729b5a6.js.map

File diff suppressed because one or more lines are too long

4
api/src/main/resources/static/js/898-legacy.1088a69b.js → api/src/main/resources/static/js/469-legacy.9029bf4c.js

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/898-legacy.1088a69b.js.map → api/src/main/resources/static/js/469-legacy.9029bf4c.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/469-legacy.e74a784c.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/469-legacy.e74a784c.js.map

File diff suppressed because one or more lines are too long

33
api/src/main/resources/static/js/656.0ec06236.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/656.0ec06236.js.map

File diff suppressed because one or more lines are too long

33
api/src/main/resources/static/js/695-legacy.cb00cc3f.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/695-legacy.cb00cc3f.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/850-legacy.f921a728.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/850-legacy.f921a728.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/850.e3199b2f.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/850.e3199b2f.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/858-legacy.470bc5ce.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/858-legacy.470bc5ce.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/858.372a44ff.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/858.372a44ff.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/899-legacy.c2da2b56.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/899-legacy.c2da2b56.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/899.6523d40b.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/899.6523d40b.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/968.8a1eeafd.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/968.8a1eeafd.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/app-legacy.b2808186.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/app-legacy.b2808186.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/app-legacy.ebb10190.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/app-legacy.ebb10190.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/app.6b8dcbe2.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/app.6b8dcbe2.js.map

File diff suppressed because one or more lines are too long

2
api/src/main/resources/static/js/app.e6e2e76f.js

File diff suppressed because one or more lines are too long

1
api/src/main/resources/static/js/app.e6e2e76f.js.map

File diff suppressed because one or more lines are too long

4
core/src/main/java/com/databasir/core/domain/database/converter/DatabaseTypePojoConverter.java

@ -14,9 +14,9 @@ public interface DatabaseTypePojoConverter {
@Mapping(target = "id", ignore = true)
@Mapping(target = "updateAt", ignore = true)
@Mapping(target = "createAt", ignore = true)
DatabaseTypePojo of(DatabaseTypeCreateRequest request);
DatabaseTypePojo of(DatabaseTypeCreateRequest request, String jdbcDriverFilePath);
DatabaseTypePojo of(DatabaseTypeUpdateRequest request);
DatabaseTypePojo of(DatabaseTypeUpdateRequest request, String jdbcDriverFilePath);
DatabaseTypeDetailResponse toDetailResponse(DatabaseTypePojo data);

2
core/src/main/java/com/databasir/core/domain/database/data/DatabaseTypeDetailResponse.java

@ -17,6 +17,8 @@ public class DatabaseTypeDetailResponse {
private String jdbcDriverFileUrl;
private String jdbcDriverFilePath;
private String jdbcDriverClassName;
private String jdbcProtocol;

2
core/src/main/java/com/databasir/core/domain/database/data/DatabaseTypePageResponse.java

@ -17,6 +17,8 @@ public class DatabaseTypePageResponse {
private String jdbcDriverFileUrl;
private String jdbcDriverFilePath;
private String jdbcDriverClassName;
private String jdbcProtocol;

2
core/src/main/java/com/databasir/core/domain/database/data/DatabaseTypeSimpleResponse.java

@ -12,4 +12,6 @@ public class DatabaseTypeSimpleResponse {
private String urlPattern;
private String jdbcProtocol;
private String icon;
}

36
core/src/main/java/com/databasir/core/domain/database/service/DatabaseTypeService.java

@ -5,6 +5,7 @@ import com.databasir.core.domain.database.converter.DatabaseTypePojoConverter;
import com.databasir.core.domain.database.data.*;
import com.databasir.core.infrastructure.connection.DatabaseTypes;
import com.databasir.core.infrastructure.driver.DriverResources;
import com.databasir.core.infrastructure.driver.DriverResult;
import com.databasir.dao.impl.DatabaseTypeDao;
import com.databasir.dao.impl.ProjectDao;
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
@ -36,8 +37,13 @@ public class DatabaseTypeService {
private final DatabaseTypePojoConverter databaseTypePojoConverter;
public Integer create(DatabaseTypeCreateRequest request) {
driverResources.validateJar(request.getJdbcDriverFileUrl(), request.getJdbcDriverClassName());
DatabaseTypePojo pojo = databaseTypePojoConverter.of(request);
if (databaseTypeDao.existsByDatabaseType(request.getDatabaseType())) {
throw DomainErrors.DATABASE_TYPE_NAME_DUPLICATE.exception();
}
DriverResult result =
driverResources.load(null, request.getJdbcDriverFileUrl(), request.getDatabaseType());
driverResources.validateDriverJar(result.getDriverFile(), request.getJdbcDriverClassName());
DatabaseTypePojo pojo = databaseTypePojoConverter.of(request, result.getDriverFilePath());
try {
return databaseTypeDao.insertAndReturnId(pojo);
} catch (DuplicateKeyException e) {
@ -48,24 +54,27 @@ public class DatabaseTypeService {
@Transactional
public void update(DatabaseTypeUpdateRequest request) {
databaseTypeDao.selectOptionalById(request.getId()).ifPresent(data -> {
if (DatabaseTypes.has(data.getDatabaseType())) {
throw DomainErrors.MUST_NOT_MODIFY_SYSTEM_DEFAULT_DATABASE_TYPE.exception();
DatabaseTypePojo pojo;
if (!Objects.equals(request.getDatabaseType(), data.getDatabaseType())
|| !Objects.equals(request.getJdbcDriverFileUrl(), data.getJdbcDriverFileUrl())) {
// 名称修改,下载地址修改需要删除原有的 driver 并重新下载验证
driverResources.deleteByDatabaseType(data.getDatabaseType());
// download
DriverResult result =
driverResources.load(null, request.getJdbcDriverFileUrl(), request.getDatabaseType());
driverResources.validateDriverJar(result.getDriverFile(), request.getJdbcDriverClassName());
// validate
pojo = databaseTypePojoConverter.of(request, result.getDriverFilePath());
} else {
pojo = databaseTypePojoConverter.of(request, data.getJdbcDriverFilePath());
}
driverResources.validateJar(request.getJdbcDriverFileUrl(), request.getJdbcDriverClassName());
DatabaseTypePojo pojo = databaseTypePojoConverter.of(request);
try {
databaseTypeDao.updateById(pojo);
} catch (DuplicateKeyException e) {
throw DomainErrors.DATABASE_TYPE_NAME_DUPLICATE.exception();
}
// 名称修改,下载地址修改需要删除原有的 driver
if (!Objects.equals(request.getDatabaseType(), data.getDatabaseType())
|| !Objects.equals(request.getJdbcDriverFileUrl(), data.getJdbcDriverFileUrl())) {
driverResources.deleteByDatabaseType(data.getDatabaseType());
}
});
}
public void deleteById(Integer id) {
@ -99,6 +108,7 @@ public class DatabaseTypeService {
response.setUrlPattern(type.getUrlPattern());
response.setDescription(type.getDescription());
response.setJdbcProtocol(type.getJdbcProtocol());
response.setIcon(type.getIcon());
return response;
})
.collect(Collectors.toList());

14
core/src/main/java/com/databasir/core/domain/document/service/DocumentService.java

@ -31,6 +31,7 @@ import org.springframework.util.CollectionUtils;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -138,9 +139,20 @@ public class DocumentService {
DatabasirConfig databasirConfig = new DatabasirConfig();
databasirConfig.setIgnoreTableNameRegex(jsonConverter.fromJson(rule.getIgnoreTableNameRegexArray()));
databasirConfig.setIgnoreTableColumnNameRegex(jsonConverter.fromJson(rule.getIgnoreColumnNameRegexArray()));
return Databasir.of(databasirConfig)
try {
DatabaseMeta databaseMeta = Databasir.of(databasirConfig)
.get(jdbcConnection, dataSource.getDatabaseName(), dataSource.getSchemaName())
.orElseThrow(DomainErrors.DATABASE_META_NOT_FOUND::exception);
return databaseMeta;
} finally {
try {
if (!jdbcConnection.isClosed()) {
jdbcConnection.close();
}
} catch (SQLException e) {
log.error("close jdbc connection error", e);
}
}
}
private void saveNewDocument(DatabaseMeta meta,

16
core/src/main/java/com/databasir/core/infrastructure/connection/CustomDatabaseConnectionFactory.java

@ -2,6 +2,7 @@ package com.databasir.core.infrastructure.connection;
import com.databasir.core.domain.DomainErrors;
import com.databasir.core.infrastructure.driver.DriverResources;
import com.databasir.core.infrastructure.driver.DriverResult;
import com.databasir.dao.impl.DatabaseTypeDao;
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
import lombok.RequiredArgsConstructor;
@ -17,6 +18,7 @@ import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Objects;
import java.util.Properties;
@Component
@ -38,8 +40,8 @@ public class CustomDatabaseConnectionFactory implements DatabaseConnectionFactor
public Connection getConnection(Context context) throws SQLException {
String databaseType = context.getDatabaseType();
DatabaseTypePojo type = databaseTypeDao.selectByDatabaseType(databaseType);
File driverFile = driverResources.loadOrDownloadByDatabaseType(databaseType, type.getJdbcDriverFileUrl());
File driverFile = loadDriver(type);
URLClassLoader loader = null;
try {
loader = new URLClassLoader(
@ -53,7 +55,6 @@ public class CustomDatabaseConnectionFactory implements DatabaseConnectionFactor
throw DomainErrors.CONNECT_DATABASE_FAILED.exception(e.getMessage());
}
// retrieve the driver class
Class<?> clazz = null;
Driver driver = null;
try {
@ -81,4 +82,15 @@ public class CustomDatabaseConnectionFactory implements DatabaseConnectionFactor
return driver.connect(jdbcUrl, info);
}
private File loadDriver(DatabaseTypePojo type) {
String databaseType = type.getDatabaseType();
String file = type.getJdbcDriverFilePath();
String url = type.getJdbcDriverFileUrl();
DriverResult result = driverResources.load(file, url, databaseType);
File driverFile = result.getDriverFile();
if (!Objects.equals(result.getDriverFilePath(), type.getJdbcDriverFilePath())) {
databaseTypeDao.updateDriverFile(type.getId(), result.getDriverFilePath());
}
return driverFile;
}
}

135
core/src/main/java/com/databasir/core/infrastructure/driver/DriverResources.java

@ -19,7 +19,6 @@ import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.UUID;
import java.util.jar.JarFile;
@ -33,27 +32,77 @@ public class DriverResources {
private final RestTemplate restTemplate;
public void deleteByDatabaseType(String databaseType) {
Path path = Paths.get(driverFilePath(driverBaseDirectory, databaseType));
public DriverResult load(String driverFilePath, String driverFileUrl, String databaseType) {
if (driverFilePath == null) {
String targetFile = targetDriverFile(databaseType);
File file = download(driverFileUrl, targetFile);
return new DriverResult(targetFile, file);
}
File driverFile = Paths.get(driverFilePath).toFile();
if (driverFile.exists()) {
return new DriverResult(driverFilePath, driverFile);
} else {
String targetFile = targetDriverFile(databaseType);
File file = download(driverFileUrl, targetFile);
return new DriverResult(targetFile, file);
}
}
private File download(String driverFileUrl, String targetFile) {
Path path = Path.of(targetFile);
// create parent directory
if (Files.notExists(path)) {
path.getParent().toFile().mkdirs();
try {
Files.deleteIfExists(path);
Files.createFile(path);
} catch (IOException e) {
log.error("delete driver error " + databaseType, e);
log.error("create file error " + targetFile, e);
throw DomainErrors.DOWNLOAD_DRIVER_ERROR.exception(e.getMessage());
}
}
public Optional<File> loadByDatabaseType(String databaseType) {
Path path = Paths.get(driverFilePath(driverBaseDirectory, databaseType));
if (Files.exists(path)) {
return Optional.of(path.toFile());
// download
try {
return restTemplate.execute(driverFileUrl, HttpMethod.GET, null, response -> {
if (response.getStatusCode().is2xxSuccessful()) {
File file = path.toFile();
FileOutputStream out = new FileOutputStream(file);
StreamUtils.copy(response.getBody(), out);
IOUtils.closeQuietly(out, ex -> log.error("close file error", ex));
log.info("{} download success ", targetFile);
return file;
} else {
return Optional.empty();
log.error("{} download error from {}: {} ", targetFile, driverFileUrl, response);
throw DomainErrors.DOWNLOAD_DRIVER_ERROR.exception("驱动下载失败:"
+ response.getStatusCode()
+ ", "
+ response.getStatusText());
}
});
} catch (RestClientException e) {
log.error(targetFile + " download driver error", e);
throw DomainErrors.DOWNLOAD_DRIVER_ERROR.exception(e.getMessage());
}
}
public File loadOrDownloadByDatabaseType(String databaseType, String driverFileUrl) {
return loadByDatabaseType(databaseType)
.orElseGet(() -> download(driverFileUrl, driverFilePath(driverBaseDirectory, databaseType)));
public void deleteByDatabaseType(String databaseType) {
String baseDir = driverBaseDirectory + "/" + databaseType;
Path path = Paths.get(baseDir);
try {
if (Files.exists(path)) {
Files.list(path).forEach(file -> {
try {
Files.deleteIfExists(file);
} catch (IOException e) {
log.error("delete file error " + file, e);
}
});
}
Files.deleteIfExists(path);
} catch (IOException e) {
log.error("delete driver error " + databaseType, e);
}
}
public String resolveDriverClassName(String driverFileUrl) {
@ -100,47 +149,7 @@ public class DriverResources {
return driverClassName;
}
private File download(String driverFileUrl, String targetFile) {
Path path = Path.of(targetFile);
// create parent directory
if (Files.notExists(path)) {
path.getParent().toFile().mkdirs();
try {
Files.createFile(path);
} catch (IOException e) {
log.error("create file error " + targetFile, e);
throw DomainErrors.DOWNLOAD_DRIVER_ERROR.exception(e.getMessage());
}
}
// download
try {
return restTemplate.execute(driverFileUrl, HttpMethod.GET, null, response -> {
if (response.getStatusCode().is2xxSuccessful()) {
File file = path.toFile();
FileOutputStream out = new FileOutputStream(file);
StreamUtils.copy(response.getBody(), out);
IOUtils.closeQuietly(out, ex -> log.error("close file error", ex));
log.info("{} download success ", targetFile);
return file;
} else {
log.error("{} download error from {}: {} ", targetFile, driverFileUrl, response);
throw DomainErrors.DOWNLOAD_DRIVER_ERROR.exception("驱动下载失败:"
+ response.getStatusCode()
+ ", "
+ response.getStatusText());
}
});
} catch (RestClientException e) {
log.error(targetFile + " download driver error", e);
throw DomainErrors.DOWNLOAD_DRIVER_ERROR.exception(e.getMessage());
}
}
public void validateJar(String driverFileUrl, String className) {
String tempFilePath = "temp/" + UUID.randomUUID() + ".jar";
File driverFile = download(driverFileUrl, tempFilePath);
public void validateDriverJar(File driverFile, String className) {
URLClassLoader loader = null;
try {
loader = new URLClassLoader(
@ -165,22 +174,12 @@ public class DriverResources {
throw DomainErrors.DRIVER_CLASS_NOT_FOUND.exception("驱动初始化异常, 请检查驱动类名:" + e.getMessage());
} finally {
IOUtils.closeQuietly(loader);
try {
Files.deleteIfExists(driverFile.toPath());
} catch (IOException e) {
log.error("delete driver error " + tempFilePath, e);
}
}
}
private String driverFilePath(String baseDir, String databaseType) {
String fileName = databaseType + ".jar";
String filePath;
if (baseDir.endsWith(File.separator)) {
filePath = baseDir + fileName;
} else {
filePath = baseDir + File.separator + fileName;
}
return filePath;
private String targetDriverFile(String databaseType) {
return driverBaseDirectory
+ "/" + databaseType
+ "/" + System.currentTimeMillis() + ".jar";
}
}

18
core/src/main/java/com/databasir/core/infrastructure/driver/DriverResult.java

@ -0,0 +1,18 @@
package com.databasir.core.infrastructure.driver;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.File;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DriverResult {
private String driverFilePath;
private File driverFile;
}

6
core/src/test/java/com/databasir/core/domain/database/service/DatabaseTypeServiceTest.java

@ -6,6 +6,7 @@ import com.databasir.core.domain.DomainErrors;
import com.databasir.core.domain.database.data.DatabaseTypeCreateRequest;
import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest;
import com.databasir.core.infrastructure.driver.DriverResources;
import com.databasir.core.infrastructure.driver.DriverResult;
import com.databasir.dao.impl.DatabaseTypeDao;
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
import org.junit.jupiter.api.Assertions;
@ -17,6 +18,7 @@ import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.transaction.annotation.Transactional;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
@Transactional
@ -33,7 +35,9 @@ class DatabaseTypeServiceTest extends BaseTest {
@BeforeEach
public void setUp() {
Mockito.doNothing().when(driverResources).validateJar(anyString(), anyString());
Mockito.doNothing().when(driverResources).validateDriverJar(any(), anyString());
Mockito.when(driverResources.load(any(), anyString(), anyString()))
.thenReturn(new DriverResult("", null));
}
@Test

13
dao/generated-src/jooq/main/java/com/databasir/dao/tables/DatabaseType.java

@ -17,7 +17,7 @@ import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row12;
import org.jooq.Row13;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
@ -75,6 +75,11 @@ public class DatabaseType extends TableImpl<DatabaseTypeRecord> {
*/
public final TableField<DatabaseTypeRecord, String> JDBC_DRIVER_FILE_URL = createField(DSL.name("jdbc_driver_file_url"), SQLDataType.VARCHAR(1024).nullable(false), this, "");
/**
* The column <code>databasir.database_type.jdbc_driver_file_path</code>.
*/
public final TableField<DatabaseTypeRecord, String> JDBC_DRIVER_FILE_PATH = createField(DSL.name("jdbc_driver_file_path"), SQLDataType.VARCHAR(512), this, "");
/**
* The column <code>databasir.database_type.jdbc_driver_class_name</code>.
*/
@ -190,11 +195,11 @@ public class DatabaseType extends TableImpl<DatabaseTypeRecord> {
}
// -------------------------------------------------------------------------
// Row12 type methods
// Row13 type methods
// -------------------------------------------------------------------------
@Override
public Row12<Integer, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row12) super.fieldsRow();
public Row13<Integer, String, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row13) super.fieldsRow();
}
}

19
dao/generated-src/jooq/main/java/com/databasir/dao/tables/pojos/DatabaseTypePojo.java

@ -21,6 +21,7 @@ public class DatabaseTypePojo implements Serializable {
private String icon;
private String description;
private String jdbcDriverFileUrl;
private String jdbcDriverFilePath;
private String jdbcDriverClassName;
private String jdbcProtocol;
private String urlPattern;
@ -37,6 +38,7 @@ public class DatabaseTypePojo implements Serializable {
this.icon = value.icon;
this.description = value.description;
this.jdbcDriverFileUrl = value.jdbcDriverFileUrl;
this.jdbcDriverFilePath = value.jdbcDriverFilePath;
this.jdbcDriverClassName = value.jdbcDriverClassName;
this.jdbcProtocol = value.jdbcProtocol;
this.urlPattern = value.urlPattern;
@ -52,6 +54,7 @@ public class DatabaseTypePojo implements Serializable {
String icon,
String description,
String jdbcDriverFileUrl,
String jdbcDriverFilePath,
String jdbcDriverClassName,
String jdbcProtocol,
String urlPattern,
@ -65,6 +68,7 @@ public class DatabaseTypePojo implements Serializable {
this.icon = icon;
this.description = description;
this.jdbcDriverFileUrl = jdbcDriverFileUrl;
this.jdbcDriverFilePath = jdbcDriverFilePath;
this.jdbcDriverClassName = jdbcDriverClassName;
this.jdbcProtocol = jdbcProtocol;
this.urlPattern = urlPattern;
@ -146,6 +150,20 @@ public class DatabaseTypePojo implements Serializable {
this.jdbcDriverFileUrl = jdbcDriverFileUrl;
}
/**
* Getter for <code>databasir.database_type.jdbc_driver_file_path</code>.
*/
public String getJdbcDriverFilePath() {
return this.jdbcDriverFilePath;
}
/**
* Setter for <code>databasir.database_type.jdbc_driver_file_path</code>.
*/
public void setJdbcDriverFilePath(String jdbcDriverFilePath) {
this.jdbcDriverFilePath = jdbcDriverFilePath;
}
/**
* Getter for <code>databasir.database_type.jdbc_driver_class_name</code>.
*/
@ -253,6 +271,7 @@ public class DatabaseTypePojo implements Serializable {
sb.append(", ").append(icon);
sb.append(", ").append(description);
sb.append(", ").append(jdbcDriverFileUrl);
sb.append(", ").append(jdbcDriverFilePath);
sb.append(", ").append(jdbcDriverClassName);
sb.append(", ").append(jdbcProtocol);
sb.append(", ").append(urlPattern);

139
dao/generated-src/jooq/main/java/com/databasir/dao/tables/records/DatabaseTypeRecord.java

@ -6,21 +6,20 @@ package com.databasir.dao.tables.records;
import com.databasir.dao.tables.DatabaseType;
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
import java.time.LocalDateTime;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record12;
import org.jooq.Row12;
import org.jooq.Record13;
import org.jooq.Row13;
import org.jooq.impl.UpdatableRecordImpl;
import java.time.LocalDateTime;
/**
* customer database types
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord> implements Record12<Integer, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> {
public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord> implements Record13<Integer, String, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> {
private static final long serialVersionUID = 1L;
@ -96,102 +95,116 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
return (String) get(4);
}
/**
* Setter for <code>databasir.database_type.jdbc_driver_file_path</code>.
*/
public void setJdbcDriverFilePath(String value) {
set(5, value);
}
/**
* Getter for <code>databasir.database_type.jdbc_driver_file_path</code>.
*/
public String getJdbcDriverFilePath() {
return (String) get(5);
}
/**
* Setter for <code>databasir.database_type.jdbc_driver_class_name</code>.
*/
public void setJdbcDriverClassName(String value) {
set(5, value);
set(6, value);
}
/**
* Getter for <code>databasir.database_type.jdbc_driver_class_name</code>.
*/
public String getJdbcDriverClassName() {
return (String) get(5);
return (String) get(6);
}
/**
* Setter for <code>databasir.database_type.jdbc_protocol</code>.
*/
public void setJdbcProtocol(String value) {
set(6, value);
set(7, value);
}
/**
* Getter for <code>databasir.database_type.jdbc_protocol</code>.
*/
public String getJdbcProtocol() {
return (String) get(6);
return (String) get(7);
}
/**
* Setter for <code>databasir.database_type.url_pattern</code>.
*/
public void setUrlPattern(String value) {
set(7, value);
set(8, value);
}
/**
* Getter for <code>databasir.database_type.url_pattern</code>.
*/
public String getUrlPattern() {
return (String) get(7);
return (String) get(8);
}
/**
* Setter for <code>databasir.database_type.deleted</code>.
*/
public void setDeleted(Boolean value) {
set(8, value);
set(9, value);
}
/**
* Getter for <code>databasir.database_type.deleted</code>.
*/
public Boolean getDeleted() {
return (Boolean) get(8);
return (Boolean) get(9);
}
/**
* Setter for <code>databasir.database_type.deleted_token</code>.
*/
public void setDeletedToken(Integer value) {
set(9, value);
set(10, value);
}
/**
* Getter for <code>databasir.database_type.deleted_token</code>.
*/
public Integer getDeletedToken() {
return (Integer) get(9);
return (Integer) get(10);
}
/**
* Setter for <code>databasir.database_type.update_at</code>.
*/
public void setUpdateAt(LocalDateTime value) {
set(10, value);
set(11, value);
}
/**
* Getter for <code>databasir.database_type.update_at</code>.
*/
public LocalDateTime getUpdateAt() {
return (LocalDateTime) get(10);
return (LocalDateTime) get(11);
}
/**
* Setter for <code>databasir.database_type.create_at</code>.
*/
public void setCreateAt(LocalDateTime value) {
set(11, value);
set(12, value);
}
/**
* Getter for <code>databasir.database_type.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return (LocalDateTime) get(11);
return (LocalDateTime) get(12);
}
// -------------------------------------------------------------------------
@ -204,17 +217,17 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
}
// -------------------------------------------------------------------------
// Record12 type implementation
// Record13 type implementation
// -------------------------------------------------------------------------
@Override
public Row12<Integer, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row12) super.fieldsRow();
public Row13<Integer, String, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row13) super.fieldsRow();
}
@Override
public Row12<Integer, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> valuesRow() {
return (Row12) super.valuesRow();
public Row13<Integer, String, String, String, String, String, String, String, String, Boolean, Integer, LocalDateTime, LocalDateTime> valuesRow() {
return (Row13) super.valuesRow();
}
@Override
@ -244,36 +257,41 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
@Override
public Field<String> field6() {
return DatabaseType.DATABASE_TYPE.JDBC_DRIVER_CLASS_NAME;
return DatabaseType.DATABASE_TYPE.JDBC_DRIVER_FILE_PATH;
}
@Override
public Field<String> field7() {
return DatabaseType.DATABASE_TYPE.JDBC_PROTOCOL;
return DatabaseType.DATABASE_TYPE.JDBC_DRIVER_CLASS_NAME;
}
@Override
public Field<String> field8() {
return DatabaseType.DATABASE_TYPE.JDBC_PROTOCOL;
}
@Override
public Field<String> field9() {
return DatabaseType.DATABASE_TYPE.URL_PATTERN;
}
@Override
public Field<Boolean> field9() {
public Field<Boolean> field10() {
return DatabaseType.DATABASE_TYPE.DELETED;
}
@Override
public Field<Integer> field10() {
public Field<Integer> field11() {
return DatabaseType.DATABASE_TYPE.DELETED_TOKEN;
}
@Override
public Field<LocalDateTime> field11() {
public Field<LocalDateTime> field12() {
return DatabaseType.DATABASE_TYPE.UPDATE_AT;
}
@Override
public Field<LocalDateTime> field12() {
public Field<LocalDateTime> field13() {
return DatabaseType.DATABASE_TYPE.CREATE_AT;
}
@ -304,36 +322,41 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
@Override
public String component6() {
return getJdbcDriverClassName();
return getJdbcDriverFilePath();
}
@Override
public String component7() {
return getJdbcProtocol();
return getJdbcDriverClassName();
}
@Override
public String component8() {
return getJdbcProtocol();
}
@Override
public String component9() {
return getUrlPattern();
}
@Override
public Boolean component9() {
public Boolean component10() {
return getDeleted();
}
@Override
public Integer component10() {
public Integer component11() {
return getDeletedToken();
}
@Override
public LocalDateTime component11() {
public LocalDateTime component12() {
return getUpdateAt();
}
@Override
public LocalDateTime component12() {
public LocalDateTime component13() {
return getCreateAt();
}
@ -364,36 +387,41 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
@Override
public String value6() {
return getJdbcDriverClassName();
return getJdbcDriverFilePath();
}
@Override
public String value7() {
return getJdbcProtocol();
return getJdbcDriverClassName();
}
@Override
public String value8() {
return getJdbcProtocol();
}
@Override
public String value9() {
return getUrlPattern();
}
@Override
public Boolean value9() {
public Boolean value10() {
return getDeleted();
}
@Override
public Integer value10() {
public Integer value11() {
return getDeletedToken();
}
@Override
public LocalDateTime value11() {
public LocalDateTime value12() {
return getUpdateAt();
}
@Override
public LocalDateTime value12() {
public LocalDateTime value13() {
return getCreateAt();
}
@ -429,48 +457,54 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
@Override
public DatabaseTypeRecord value6(String value) {
setJdbcDriverClassName(value);
setJdbcDriverFilePath(value);
return this;
}
@Override
public DatabaseTypeRecord value7(String value) {
setJdbcProtocol(value);
setJdbcDriverClassName(value);
return this;
}
@Override
public DatabaseTypeRecord value8(String value) {
setJdbcProtocol(value);
return this;
}
@Override
public DatabaseTypeRecord value9(String value) {
setUrlPattern(value);
return this;
}
@Override
public DatabaseTypeRecord value9(Boolean value) {
public DatabaseTypeRecord value10(Boolean value) {
setDeleted(value);
return this;
}
@Override
public DatabaseTypeRecord value10(Integer value) {
public DatabaseTypeRecord value11(Integer value) {
setDeletedToken(value);
return this;
}
@Override
public DatabaseTypeRecord value11(LocalDateTime value) {
public DatabaseTypeRecord value12(LocalDateTime value) {
setUpdateAt(value);
return this;
}
@Override
public DatabaseTypeRecord value12(LocalDateTime value) {
public DatabaseTypeRecord value13(LocalDateTime value) {
setCreateAt(value);
return this;
}
@Override
public DatabaseTypeRecord values(Integer value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, Boolean value9, Integer value10, LocalDateTime value11, LocalDateTime value12) {
public DatabaseTypeRecord values(Integer value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9, Boolean value10, Integer value11, LocalDateTime value12, LocalDateTime value13) {
value1(value1);
value2(value2);
value3(value3);
@ -483,6 +517,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
value10(value10);
value11(value11);
value12(value12);
value13(value13);
return this;
}
@ -500,7 +535,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
/**
* Create a detached, initialised DatabaseTypeRecord
*/
public DatabaseTypeRecord(Integer id, String databaseType, String icon, String description, String jdbcDriverFileUrl, String jdbcDriverClassName, String jdbcProtocol, String urlPattern, Boolean deleted, Integer deletedToken, LocalDateTime updateAt, LocalDateTime createAt) {
public DatabaseTypeRecord(Integer id, String databaseType, String icon, String description, String jdbcDriverFileUrl, String jdbcDriverFilePath, String jdbcDriverClassName, String jdbcProtocol, String urlPattern, Boolean deleted, Integer deletedToken, LocalDateTime updateAt, LocalDateTime createAt) {
super(DatabaseType.DATABASE_TYPE);
setId(id);
@ -508,6 +543,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
setIcon(icon);
setDescription(description);
setJdbcDriverFileUrl(jdbcDriverFileUrl);
setJdbcDriverFilePath(jdbcDriverFilePath);
setJdbcDriverClassName(jdbcDriverClassName);
setJdbcProtocol(jdbcProtocol);
setUrlPattern(urlPattern);
@ -529,6 +565,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl<DatabaseTypeRecord>
setIcon(value.getIcon());
setDescription(value.getDescription());
setJdbcDriverFileUrl(value.getJdbcDriverFileUrl());
setJdbcDriverFilePath(value.getJdbcDriverFilePath());
setJdbcDriverClassName(value.getJdbcDriverClassName());
setJdbcProtocol(value.getJdbcProtocol());
setUrlPattern(value.getUrlPattern());

8
dao/src/main/java/com/databasir/dao/impl/DatabaseTypeDao.java

@ -58,4 +58,12 @@ public class DatabaseTypeDao extends BaseDao<DatabaseTypePojo> {
public Optional<DatabaseTypePojo> selectOptionalById(Integer id) {
return super.selectOptionalOne(DATABASE_TYPE.DELETED.eq(false).and(DATABASE_TYPE.ID.eq(id)));
}
public void updateDriverFile(Integer id, String driverFile) {
this.getDslContext()
.update(DATABASE_TYPE)
.set(DATABASE_TYPE.JDBC_DRIVER_FILE_PATH, driverFile)
.where(DATABASE_TYPE.ID.eq(id))
.execute();
}
}

380
dao/src/main/resources/db/init/init.sql

@ -0,0 +1,380 @@
CREATE DATABASE IF NOT EXISTS databasir;
USE databasir;
CREATE TABLE IF NOT EXISTS sys_key
(
id INT PRIMARY KEY AUTO_INCREMENT,
rsa_public_key TEXT NOT NULL,
rsa_private_key TEXT NOT NULL,
aes_key TEXT NOT NULL,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS sys_mail
(
id INT PRIMARY KEY AUTO_INCREMENT,
username TEXT NOT NULL,
password TEXT NOT NULL,
smtp_host VARCHAR(512) NOT NULL,
smtp_port INT NOT NULL,
use_ssl BOOLEAN NOT NULL DEFAULT FALSE,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS user
(
id INT PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(512) NOT NULL,
username VARCHAR(128) NOT NULL,
password TEXT NOT NULL,
nickname VARCHAR(255) NOT NULL,
avatar VARCHAR(512) DEFAULT NULL,
enabled BOOLEAN NOT NULL DEFAULT FALSE,
deleted BOOLEAN NOT NULL DEFAULT FALSE,
deleted_token INT NOT NULL DEFAULT 0,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_email (email, deleted_token),
CONSTRAINT UNIQUE uk_username (username, deleted_token)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS user_role
(
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT NOT NULL,
role VARCHAR(128) NOT NULL COMMENT 'SYS_OWNER, GROUP_OWNER, GROUP_MEMBER',
group_id INT DEFAULT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_user_id_group_id_role (user_id, group_id, role)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `group`
(
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description VARCHAR(512) NOT NULL,
deleted BOOLEAN NOT NULL DEFAULT FALSE,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `project`
(
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
group_id INT NOT NULL,
deleted BOOLEAN NOT NULL DEFAULT FALSE,
deleted_token INT NOT NULL DEFAULT 0 COMMENT 'default is 0, it will be set to {id} when deleted',
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_group_id_name_deleted_token (group_id, name, deleted_token)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `project_sync_rule`
(
id INT PRIMARY KEY AUTO_INCREMENT,
project_id INT NOT NULL,
ignore_table_name_regex_array JSON NOT NULL,
ignore_column_name_regex_array JSON NOT NULL,
is_auto_sync BOOLEAN NOT NULL DEFAULT FALSE,
auto_sync_cron VARCHAR(128) NOT NULL DEFAULT '',
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_project_id (project_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `data_source`
(
id INT PRIMARY KEY AUTO_INCREMENT,
project_id INT NOT NULL,
database_name VARCHAR(255) NOT NULL,
schema_name VARCHAR(255) NOT NULL,
database_type VARCHAR(255) NOT NULL,
url TEXT NOT NULL,
username TEXT NOT NULL,
password TEXT NOT NULL,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_project_id (project_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `data_source_property`
(
id INT PRIMARY KEY AUTO_INCREMENT,
data_source_id INT NOT NULL,
`key` TEXT NOT NULL,
`value` TEXT NOT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_data_source_id (data_source_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS database_document
(
id INT PRIMARY KEY AUTO_INCREMENT,
project_id INT NOT NULL,
database_name VARCHAR(255) NOT NULL,
schema_name VARCHAR(255) NOT NULL,
product_name TEXT NOT NULL,
product_version TEXT NOT NULL,
version BIGINT NOT NULL DEFAULT 1,
is_archive BOOLEAN NOT NULL DEFAULT FALSE,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_project_id_version_is_archive (project_id, version, is_archive)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS table_document
(
id INT PRIMARY KEY AUTO_INCREMENT,
database_document_id INT NOT NULL,
name TEXT NOT NULL,
type VARCHAR(255) NOT NULL,
comment VARCHAR(512) DEFAULT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_database_document_id (database_document_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS table_column_document
(
id INT PRIMARY KEY AUTO_INCREMENT,
table_document_id INT NOT NULL,
database_document_id INT NOT NULL,
name TEXT NOT NULL,
type VARCHAR(255) NOT NULL,
data_type INT NOT NULL DEFAULT 99999,
comment VARCHAR(512) DEFAULT NULL,
default_value VARCHAR(512) DEFAULT NULL,
size INT NOT NULL,
decimal_digits INT DEFAULT NULL,
is_primary_key BOOLEAN NOT NULL,
nullable VARCHAR(64) NOT NULL COMMENT 'YES, NO, UNKNOWN',
auto_increment VARCHAR(64) NOT NULL COMMENT 'YES, NO, UNKNOWN',
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_table_document_id (table_document_id),
INDEX idx_database_document_id (database_document_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS table_foreign_key_document
(
id INT PRIMARY KEY AUTO_INCREMENT,
table_document_id INT NOT NULL,
database_document_id INT NOT NULL,
key_seq INT NOT NULL DEFAULT 0,
fk_name VARCHAR(255) DEFAULT NULL,
fk_table_name VARCHAR(512) NOT NULL,
fk_column_name VARCHAR(512) NOT NULL,
pk_name VARCHAR(255) DEFAULT NULL,
pk_table_name VARCHAR(512) NOT NULL,
pk_column_name VARCHAR(512) NOT NULL,
update_rule VARCHAR(128) NOT NULL COMMENT 'NO_ACTION, CASCADE, SET_NULL, SET_DEFAULT',
delete_rule VARCHAR(128) NOT NULL COMMENT 'NO_ACTION, CASCADE, SET_NULL, SET_DEFAULT',
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_table_document_id (table_document_id),
INDEX idx_database_document_id (database_document_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS table_index_document
(
id INT PRIMARY KEY AUTO_INCREMENT,
table_document_id INT NOT NULL,
database_document_id INT NOT NULL,
name TEXT NOT NULL,
is_unique BOOLEAN NOT NULL,
column_name_array JSON NOT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_table_document_id (table_document_id),
INDEX idx_database_document_id (database_document_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS table_trigger_document
(
id INT PRIMARY KEY AUTO_INCREMENT,
table_document_id INT NOT NULL,
database_document_id INT NOT NULL,
timing VARCHAR(64) NOT NULL,
manipulation VARCHAR(128) NOT NULL,
statement TEXT NOT NULL,
trigger_create_at VARCHAR(255) NOT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_table_document_id (table_document_id),
INDEX idx_database_document_id (database_document_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS login
(
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT NOT NULL,
access_token TEXT NOT NULL,
refresh_token TEXT NOT NULL,
access_token_expire_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
refresh_token_expire_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_user_id (user_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS document_discussion
(
id INT PRIMARY KEY AUTO_INCREMENT,
content TEXT NOT NULL,
user_id INT NOT NULL COMMENT 'user.id',
project_id INT NOT NULL,
table_name VARCHAR(255) NOT NULL,
column_name VARCHAR(255) DEFAULT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_project_id (project_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS operation_log
(
id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
operator_user_id INT NOT NULL COMMENT 'ref to user.id',
operator_username VARCHAR(128) NOT NULL COMMENT 'user.username',
operator_nickname VARCHAR(255) NOT NULL COMMENT 'user.nickname',
operation_module VARCHAR(128) NOT NULL,
operation_code VARCHAR(255) NOT NULL,
operation_name VARCHAR(255) NOT NULL,
operation_response JSON NOT NULL,
is_success BOOLEAN NOT NULL DEFAULT FALSE,
involved_project_id INT DEFAULT NULL COMMENT 'ref to project.id',
involved_group_id INT DEFAULT NULL COMMENT 'ref to group.id',
involved_user_id INT DEFAULT NULL COMMENT 'ref to user.id',
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS user_favorite_project
(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
user_id INT NOT NULL,
project_id INT NOT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE uk_user_id_project_id (user_id, project_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS oauth_app
(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
registration_id VARCHAR(100) NOT NULL,
app_name VARCHAR(128) NOT NULL,
app_icon VARCHAR(256) NOT NULL DEFAULT '',
app_type VARCHAR(64) NOT NULL COMMENT 'github, gitlab',
client_id VARCHAR(256),
client_secret VARCHAR(256),
auth_url VARCHAR(256),
resource_url VARCHAR(256),
scope VARCHAR(256),
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE uk_registration_id (registration_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT 'oauth app info';
CREATE TABLE IF NOT EXISTS database_type
(
id INT PRIMARY KEY AUTO_INCREMENT,
database_type VARCHAR(128) NOT NULL COMMENT 'such as mysql, postgresql, mysql5.5 and so on',
icon VARCHAR(512) NOT NULL DEFAULT '',
description VARCHAR(512) NOT NULL,
jdbc_driver_file_url VARCHAR(1024) NOT NULL,
jdbc_driver_class_name VARCHAR(255) NOT NULL,
jdbc_protocol VARCHAR(128) NOT NULL,
url_pattern VARCHAR(255) NOT NULL,
jdbc_driver_file VARCHAR(512) DEFAULT NULL,
deleted BOOLEAN NOT NULL DEFAULT FALSE,
deleted_token INT NOT NULL DEFAULT 0,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT uk_database_type_deleted_deleted_token UNIQUE (database_type, deleted, deleted_token)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT 'customer database types';
REPLACE INTO databasir.database_type (id, database_type, icon, DESCRIPTION, jdbc_driver_file_url,
jdbc_driver_class_name,
jdbc_protocol, url_pattern)
VALUES (1, 'mysql', '', 'system default mysql', 'N/A', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql',
'{{jdbc.protocol}}://{{db.url}}/{{db.name}}'),
(2, 'postgresql', '', 'system default postgresql', 'N/A', 'org.postgresql.Driver', 'jdbc:postgresql',
'{{jdbc.protocol}}://{{db.url}}/{{db.name}}');
CREATE TABLE IF NOT EXISTS document_description
(
id INT PRIMARY KEY AUTO_INCREMENT,
content TEXT NOT NULL,
project_id INT NOT NULL,
table_name VARCHAR(255) NOT NULL,
column_name VARCHAR(255) DEFAULT NULL,
update_by INT NOT NULL,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_project_id_table_name_column_name (project_id, table_name, column_name)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT 'custom document description';
CREATE TABLE IF NOT EXISTS document_template_property
(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`key` VARCHAR(255) NOT NULL,
`value` VARCHAR(255) DEFAULT NULL,
`default_value` VARCHAR(255) NOT NULL,
`type` VARCHAR(64) NOT NULL,
`create_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_type_key (`type`, `key`)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT 'template property';
CREATE TABLE IF NOT EXISTS mock_data_rule
(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`project_id` INT NOT NULL,
`table_name` VARCHAR(255) NOT NULL,
`column_name` VARCHAR(255) NOT NULL,
`dependent_table_name` VARCHAR(255) DEFAULT NULL,
`dependent_column_name` VARCHAR(255) DEFAULT NULL,
`mock_data_type` VARCHAR(255) NOT NULL DEFAULT 'AUTO / REF / SCRIPT / PHONE / DATE / TIMESTAMP / ...',
`mock_data_script` TEXT DEFAULT NULL,
`update_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`create_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT UNIQUE uk_project_id_table_name_column_name (project_id, table_name, column_name)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS project_sync_task
(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`project_id` INT NOT NULL,
`user_id` INT NOT NULL,
`status` VARCHAR(32) NOT NULL DEFAULT 'NEW' COMMENT 'NEW \ RUNNING \ FINISHED \ FAILED \ CANCELED',
`result` VARCHAR(1024) NOT NULL DEFAULT '',
`run_at` DATETIME DEFAULT NULL,
`update_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`create_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_project_id (project_id),
INDEX idx_user_id (user_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;

2
dao/src/main/resources/db/migration/V1.4.1__driver_file.sql

@ -0,0 +1,2 @@
ALTER TABLE database_type
ADD COLUMN jdbc_driver_file_path VARCHAR(512) DEFAULT NULL AFTER jdbc_driver_file_url;

2
databasir-frontend

@ -1 +1 @@
Subproject commit 65875c7d631916b6ab672caccc4ab351a1ed7c39
Subproject commit 0e1abbd7da7a26b05a6d06e78130a200f4e5e181
Loading…
Cancel
Save