{"id":9331,"date":"2023-02-14T11:19:39","date_gmt":"2023-02-14T03:19:39","guid":{"rendered":"http:\/\/123.57.164.21\/?p=9331"},"modified":"2023-02-14T11:19:39","modified_gmt":"2023-02-14T03:19:39","slug":"flyway%e7%9a%84%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=9331","title":{"rendered":"flyway\u7684\u5feb\u901f\u5165\u95e8\u6559\u7a0b"},"content":{"rendered":"\n<p><strong>\u4e00\u3001\u7b80\u5355\u4ecb\u7ecd<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Flyway \u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u6570\u636e\u5e93\u7248\u672c\u7ba1\u7406\u5de5\u5177\u3002\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\uff0c\u6216\u8005\u5728Java\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5f15\u5165\uff0c\u7528\u4e8e\u7ba1\u7406\u6211\u4eec\u7684\u6570\u636e\u5e93\u7248\u672c\u3002<\/p>\n\n\n\n<p>\u5728\u9879\u76ee\u6216\u4ea7\u54c1\u4e2d\uff0c\u5f88\u96be\u4e00\u5f00\u59cb\u5c31\u628a\u4e1a\u52a1\u7406\u6e05\u695a\uff0c\u628a\u6570\u636e\u5e93\u8868\u8bbe\u8ba1\u597d\uff0c\u56e0\u6b64\u6570\u636e\u8868\u4e5f\u4f1a\u5728\u8fed\u4ee3\u5468\u671f\u4e0d\u65ad\u8fed\u4ee3\u3002\u5728Java\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528Flyway\uff0c\u80fd\u5feb\u901f\u6709\u6548\u5730\u7528\u4e8e\u8fed\u4ee3\u6570\u636e\u5e93\u8868\u7ed3\u6784\uff0c\u5e76\u4fdd\u8bc1\u90e8\u7f72\u5230\u6d4b\u8bd5\u73af\u5883\u6216\u751f\u4ea7\u73af\u5883\u65f6\uff0c\u6570\u636e\u8868\u90fd\u662f\u4fdd\u6301\u4e00\u81f4\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Flyway\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/flywaydb.org\/documentation\/<\/pre>\n\n\n\n<p><strong>\u4e8c\u3001\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528<a rel=\"noreferrer noopener\" href=\"https:\/\/so.csdn.net\/so\/search?q=flyway&amp;spm=1001.2101.3001.7020\" target=\"_blank\">flyway<\/a><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728\u591a\u4eba\u5f00\u53d1\u7684\u9879\u76ee\u4e2d\uff0c\u6211\u4eec\u90fd\u4e60\u60ef\u4e86\u4f7f\u7528SVN\u6216\u8005Git\u6765\u5bf9\u4ee3\u7801\u505a\u7248\u672c\u63a7\u5236\uff0c\u4e3b\u8981\u7684\u76ee\u7684\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u591a\u4eba\u5f00\u53d1\u4ee3\u7801\u51b2\u7a81\u548c\u7248\u672c\u56de\u9000\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u5176\u5b9e\uff0c\u6570\u636e\u5e93\u7684\u53d8\u66f4\u4e5f\u9700\u8981\u7248\u672c\u63a7\u5236\uff0c\u5728\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\u4e0b\u9762\u7684\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul><li>\u81ea\u5df1\u5199\u7684SQL\u5fd8\u4e86\u5728\u6240\u6709\u73af\u5883\u6267\u884c\u3002<\/li><li>\u522b\u4eba\u5199\u7684SQL\u6211\u4eec\u4e0d\u80fd\u786e\u5b9a\u662f\u5426\u90fd\u5728\u6240\u6709\u73af\u5883\u6267\u884c\u8fc7\u4e86\u3002<\/li><li>\u6709\u4eba\u4fee\u6539\u4e86\u5df2\u7ecf\u6267\u884c\u8fc7\u7684SQL\uff0c\u671f\u671b\u518d\u6b21\u6267\u884c\u3002<\/li><li>\u9700\u8981\u65b0\u589e\u73af\u5883\u505a\u6570\u636e\u8fc1\u79fb\u3002<\/li><li>\u6bcf\u6b21\u53d1\u7248\u9700\u8981\u624b\u52a8\u63a7\u5236\u5148\u53d1DB\u7248\u672c\uff0c\u518d\u53d1\u5e03\u5e94\u7528\u7248\u672c\u3002<\/li><li>\u5176\u5b83\u573a\u666f\u3002<\/li><\/ul>\n\n\n\n<p>\u6709\u4e86flyway\uff0c\u8fd9\u4e9b\u95ee\u9898\u90fd\u80fd\u5f97\u5230\u5f88\u597d\u7684\u89e3\u51b3\u3002<\/p>\n\n\n\n<p><strong>\u4e09\u3001flyway\u662f\u5982\u4f55\u5de5\u4f5c\u7684<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>flyway\u5de5\u4f5c\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul><li>\u9879\u76ee\u542f\u52a8\uff0c\u5e94\u7528\u7a0b\u5e8f\u5b8c\u6210\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u7684\u5efa\u7acb\u540e\uff0cFlyway\u81ea\u52a8\u8fd0\u884c\u3002<\/li><li>\u521d\u6b21\u4f7f\u7528\u65f6\uff0cflyway\u4f1a\u521b\u5efa\u4e00\u4e2a flyway_schema_history \u8868\uff0c\u7528\u4e8e\u8bb0\u5f55sql\u6267\u884c\u8bb0\u5f55\u3002<\/li><li>Flyway\u4f1a\u626b\u63cf\u9879\u76ee\u6307\u5b9a\u8def\u5f84\u4e0b(\u9ed8\u8ba4\u662f classpath:db\/migration )\u7684\u6240\u6709sql\u811a\u672c\uff0c\u4e0e flyway_schema_history \u8868\u811a\u672c\u8bb0\u5f55\u8fdb\u884c\u6bd4\u5bf9\u3002\u5982\u679c\u6570\u636e\u5e93\u8bb0\u5f55\u6267\u884c\u8fc7\u7684\u811a\u672c\u8bb0\u5f55\uff0c\u4e0e\u9879\u76ee\u4e2d\u7684sql\u811a\u672c\u4e0d\u4e00\u81f4\uff0cFlyway\u4f1a\u62a5\u9519\u5e76\u505c\u6b62\u9879\u76ee\u6267\u884c\u3002<\/li><li>\u5982\u679c\u6821\u9a8c\u901a\u8fc7\uff0c\u5219\u6839\u636e\u8868\u4e2d\u7684sql\u8bb0\u5f55\u6700\u5927\u7248\u672c\u53f7\uff0c\u5ffd\u7565\u6240\u6709\u7248\u672c\u53f7\u4e0d\u5927\u4e8e\u8be5\u7248\u672c\u7684\u811a\u672c\u3002\u518d\u6309\u7167\u7248\u672c\u53f7\u4ece\u5c0f\u5230\u5927\uff0c\u9010\u4e2a\u6267\u884c\u5176\u4f59\u811a\u672c\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u56db\u3001\u5982\u4f55\u4f7f\u7528flyway<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>1\u3001\u5148\u8981\u521d\u59cb\u5316\u4e00\u4e2aSpringBoot\u9879\u76ee\uff0c\u5f15\u5165\u4f9d\u8d56&#8217;<\/strong><\/p>\n\n\n\n<p>\u6211\u4f7f\u7528\u7684\u7248\u672c\u662f2.3.5.RELEASE\uff0c\u5f15\u5165mysql\u3001mybatis\u3001flyway\u7b49\u4f9d\u8d56\uff0cpom.xml\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> &lt;properties>\n        &lt;java.version>1.8&lt;\/java.version>\n        &lt;project.build.sourceEncoding>UTF-8&lt;\/project.build.sourceEncoding>\n        &lt;project.reporting.outputEncoding>UTF-8&lt;\/project.reporting.outputEncoding>\n        &lt;mysql.version>8.0.25&lt;\/mysql.version>\n        &lt;mybatis-starter.version>2.2.1&lt;\/mybatis-starter.version>\n        &lt;flyway.version>6.1.0&lt;\/flyway.version>\n    &lt;\/properties>\n \n    &lt;dependencies>\n        &lt;dependency>\n            &lt;groupId>org.springframework.boot&lt;\/groupId>\n            &lt;artifactId>spring-boot-starter-web&lt;\/artifactId>\n        &lt;\/dependency>\n        &lt;dependency>\n            &lt;groupId>mysql&lt;\/groupId>\n            &lt;artifactId>mysql-connector-java&lt;\/artifactId>\n            &lt;scope>runtime&lt;\/scope>\n            &lt;version>${mysql.version}&lt;\/version>\n        &lt;\/dependency>\n        &lt;dependency>\n            &lt;groupId>org.mybatis.spring.boot&lt;\/groupId>\n            &lt;artifactId>mybatis-spring-boot-starter&lt;\/artifactId>\n            &lt;version>${mybatis-starter.version}&lt;\/version>\n        &lt;\/dependency>\n        &lt;dependency>\n            &lt;groupId>org.flywaydb&lt;\/groupId>\n            &lt;artifactId>flyway-core&lt;\/artifactId>\n            &lt;version>${flyway.version}&lt;\/version>\n        &lt;\/dependency>\n    &lt;\/dependencies>\n<\/pre>\n\n\n\n<p><strong>2\u3001\u5728application.yml\u4e2d\u6dfb\u52a0\u76f8\u5173\u914d\u7f6e<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">  # \u6570\u636e\u5e93\u8fde\u63a5\u914d\u7f6e\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql:\/\/localhost:3306\/flyway-demo?characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=Asia\/Shanghai\n    username: root\n    password: root\n  flyway:\n    # \u662f\u5426\u542f\u7528flyway\n    enabled: true\n    # \u7f16\u7801\u683c\u5f0f\uff0c\u9ed8\u8ba4UTF-8\n    encoding: UTF-8\n    # \u8fc1\u79fbsql\u811a\u672c\u6587\u4ef6\u5b58\u653e\u8def\u5f84\uff0c\u9ed8\u8ba4db\/migration\n    locations: classpath:db\/migration\n    # \u8fc1\u79fbsql\u811a\u672c\u6587\u4ef6\u540d\u79f0\u7684\u524d\u7f00\uff0c\u9ed8\u8ba4V\n    sql-migration-prefix: V\n    # \u8fc1\u79fbsql\u811a\u672c\u6587\u4ef6\u540d\u79f0\u7684\u5206\u9694\u7b26\uff0c\u9ed8\u8ba42\u4e2a\u4e0b\u5212\u7ebf__\n    sql-migration-separator: __\n    # \u8fc1\u79fbsql\u811a\u672c\u6587\u4ef6\u540d\u79f0\u7684\u540e\u7f00\n    sql-migration-suffixes: .sql\n    # \u8fc1\u79fb\u65f6\u662f\u5426\u8fdb\u884c\u6821\u9a8c\uff0c\u9ed8\u8ba4true\n    validate-on-migrate: true\n    # \u5f53\u8fc1\u79fb\u53d1\u73b0\u6570\u636e\u5e93\u975e\u7a7a\u4e14\u5b58\u5728\u6ca1\u6709\u5143\u6570\u636e\u7684\u8868\u65f6\uff0c\u81ea\u52a8\u6267\u884c\u57fa\u51c6\u8fc1\u79fb\uff0c\u65b0\u5efaschema_version\u8868\n    baseline-on-migrate: true\n<\/pre>\n\n\n\n<p><strong>3\u3001\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u4e2d\u586b\u5199\u7684\u811a\u672c\u5b58\u653e\u8def\u5f84\uff0c\u521b\u5efa\u6587\u4ef6\u5939<\/strong><\/p>\n\n\n\n<p>\u6839\u636e\u4e0a\u9762\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u811a\u672c\u5b58\u653e\u8def\u5f84\uff0c\u6211\u4eec\u9700\u8981\u5728resource\u76ee\u5f55\u4e0b\u5efa\u7acb\u6587\u4ef6\u5939\u00a0db\/migration \u3002<\/p>\n\n\n\n<p><strong>4\u3001\u6dfb\u52a0\u9700\u8981\u8fd0\u884c\u7684<a rel=\"noreferrer noopener\" href=\"https:\/\/so.csdn.net\/so\/search?q=sql%E8%84%9A%E6%9C%AC&amp;spm=1001.2101.3001.7020\" target=\"_blank\">sql\u811a\u672c<\/a>\u3002sql\u811a\u672c\u7684\u547d\u540d\u4e00\u5b9a\u8981\u89c4\u8303\uff0c\u5426\u5219\u8fd0\u884cflyway\u4f1a\u62a5\u9519<\/strong><\/p>\n\n\n\n<p>\u547d\u540d\u89c4\u5219\u4e3b\u8981\u6709\u4e24\u79cd\uff1a<\/p>\n\n\n\n<ul><li>\u4ec5\u9700\u8981\u88ab\u6267\u884c\u4e00\u6b21\u7684SQL\u547d\u540d\u4ee5\u5927\u5199\u7684&#8221;V&#8221;\u5f00\u5934\uff0cV+\u7248\u672c\u53f7(\u7248\u672c\u53f7\u7684\u6570\u5b57\u95f4\u4ee5\u201d.\u201c\u6216\u201d_\u201c\u5206\u9694\u5f00)+\u53cc\u4e0b\u5212\u7ebf(\u7528\u6765\u5206\u9694\u7248\u672c\u53f7\u548c\u63cf\u8ff0)+\u6587\u4ef6\u63cf\u8ff0+\u540e\u7f00\u540d\u3002\u4f8b\u5982\uff1a V20201100__create_user.sql\u3001V2.1.5__create_user_ddl.sql\u3001V4.1_2__add_user_dml.sql \u3002<\/li><li>\u53ef\u91cd\u590d\u8fd0\u884c\u7684SQL\uff0c\u5219\u4ee5\u5927\u5199\u7684\u201cR\u201d\u5f00\u5934\uff0c\u540e\u9762\u518d\u4ee5\u4e24\u4e2a\u4e0b\u5212\u7ebf\u5206\u5272\uff0c\u5176\u540e\u8ddf\u6587\u4ef6\u540d\u79f0\uff0c\u6700\u540e\u4ee5.sql\u7ed3\u5c3e\u3002\uff08\u4e0d\u63a8\u8350\u4f7f\u7528\uff09\u6bd4\u5982\uff1a R__truncate_user_dml.sql \u3002<\/li><\/ul>\n\n\n\n<p>\u5176\u4e2d\uff0cV\u5f00\u5934\u7684SQL\u6267\u884c\u4f18\u5148\u7ea7\u8981\u6bd4R\u5f00\u5934\u7684SQL\u4f18\u5148\u7ea7\u9ad8\u3002<\/p>\n\n\n\n<p>\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u76ee\u5f55\u5e94\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<p>\u5176\u4e2d2.1.6\u30012.1.7\u548cevery\u7684\u6587\u4ef6\u5939\u4e0d\u4f1a\u5f71\u54cdflyway\u5bf9SQL\u7684\u8bc6\u522b\u548c\u8fd0\u884c\uff0c\u53ef\u4ee5\u81ea\u884c\u53d6\u540d\u548c\u5206\u7c7b\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-23.png\" alt=\"\" class=\"wp-image-9334\" width=\"498\" height=\"297\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-23.png 700w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-23-300x179.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-23-230x137.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-23-350x209.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-23-480x287.png 480w\" sizes=\"(max-width: 498px) 100vw, 498px\" \/><\/figure><\/div>\n\n\n\n<p><strong>5\u3001\u542f\u52a8\u9879\u76ee\uff0c \u901a\u8fc7flyway\u6267\u884c\u5b9a\u4e49\u597d\u7684\u811a\u672c<\/strong><\/p>\n\n\n\n<p>\u5728\u63a7\u5236\u53f0\u53ef\u4ee5\u770b\u5230\u76f8\u5173\u65e5\u5fd7\u6253\u5370\uff0c\u5e76\u5728\u6570\u636e\u5e93\u4e2d\u67e5\u770b\u5230\u5df2\u7ecf\u521b\u5efa\u597d\u7684\u8868\u548c\u76f8\u5173\u8bb0\u5f55\u53d8\u66f4\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-1024x340.png\" alt=\"\" class=\"wp-image-9335\" width=\"576\" height=\"190\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-1024x340.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-300x100.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-768x255.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-1536x510.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-230x76.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24-350x116.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-24.png 1962w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/figure><\/div>\n\n\n\n<p><strong>6\u3001\u63d0\u793a\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u6211\u4eec\u4fee\u6539V2__add_user.sql\u4e2d\u7684\u5185\u5bb9\uff0c\u518d\u6b21\u6267\u884c\u7684\u8bdd\uff0c\u5c31\u4f1a\u62a5\u9519\uff0c\u63d0\u793a\u4fe1\u606f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>\u3000\u3000[ERROR] Migration checksum mismatch for migration version 2<\/p>\n\n\n\n<p>\u5982\u679c\u6211\u4eec\u4fee\u6539\u4e86R__add_unknown_user.sql\uff0c\u518d\u6b21\u6267\u884c\u7684\u8bdd\uff0c\u8be5\u811a\u672c\u5c31\u4f1a\u518d\u6b21\u5f97\u5230\u6267\u884c\uff0c\u5e76\u4e14flyway\u7684\u5386\u53f2\u8bb0\u5f55\u8868\u4e2d\u4e5f\u4f1a\u589e\u52a0\u672c\u6b21\u6267\u884c\u7684\u8bb0\u5f55\u3002<br><\/p>\n\n\n\n<p><strong>\u4e94\u3001maven\u63d2\u4ef6\u7684\u4f7f\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>1\u3001\u914d\u7f6e\u63d2\u4ef6<\/strong><\/p>\n\n\n\n<p>\u4ee5\u4e0a\u6b65\u9aa4\u4e2d\uff0c\u6bcf\u6b21\u60f3\u8981migration\u90fd\u9700\u8981\u8fd0\u884c\u6574\u4e2aspringboot\u9879\u76ee\uff0c\u5e76\u4e14\u53ea\u80fd\u6267\u884cmigrate\u4e00\u79cd\u547d\u4ee4\uff0c\u5176\u5b9eflyway\u8fd8\u662f\u6709\u5f88\u591a\u5176\u5b83\u547d\u4ee4\u7684\u3002maven\u63d2\u4ef6\u7ed9\u4e86\u6211\u4eec\u4e0d\u9700\u8981\u542f\u52a8\u9879\u76ee\u5c31\u80fd\u6267\u884cflyway\u5404\u79cd\u547d\u4ee4\u7684\u673a\u4f1a\u3002<\/p>\n\n\n\n<p>\u5728pom.xml\u4e2d\u5f15\u5165flyway\u7684\u63d2\u4ef6\uff0c\u540c\u65f6\u914d\u7f6e\u597d\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u8fde\u63a5\u3002<br><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;build>\n        &lt;plugins>\n            &lt;plugin>\n                &lt;groupId>org.flywaydb&lt;\/groupId>\n                &lt;artifactId>flyway-maven-plugin&lt;\/artifactId>\n                &lt;version>5.2.4&lt;\/version>\n                &lt;configuration>\n                    &lt;url>jdbc:mysql:\/\/localhost:3306\/flyway-demo?characterEncoding=utf-8&amp;amp;useSSL=false&amp;amp;serverTimezone=Asia\/Shanghai\n                    &lt;\/url>\n                    &lt;user>root&lt;\/user>\n                    &lt;password>root&lt;\/password>\n                    &lt;driver>com.mysql.cj.jdbc.Driver&lt;\/driver>\n                &lt;\/configuration>\n            &lt;\/plugin>\n        &lt;\/plugins>\n    &lt;\/build>\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25.png\" alt=\"\" class=\"wp-image-9337\" width=\"462\" height=\"198\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25.png 874w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25-300x129.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25-768x330.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25-830x357.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25-230x99.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25-350x151.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-25-480x206.png 480w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/figure><\/div>\n\n\n\n<p><strong>2\u3001\u63d2\u4ef6\u547d\u4ee4\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>\u6b64\u65f6\uff0c\u6211\u4eec\u53cc\u51fb\u6267\u884c\u4e0a\u56fe\u4e2d\u7684flyway:migrate\u7684\u6548\u679c\u548c\u542f\u52a8\u6574\u4e2a\u5de5\u7a0b\u6267\u884cmigrate\u7684\u6548\u679c\u662f\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<p>\u5176\u5b83\u547d\u4ee4\u7684\u4f5c\u7528\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul><li>baseline\uff1a\u5bf9\u5df2\u7ecf\u5b58\u5728\u6570\u636e\u5e93Schema\u7ed3\u6784\u7684\u6570\u636e\u5e93\u4e00\u79cd\u89e3\u51b3\u65b9\u6848\u3002\u5b9e\u73b0\u5728\u975e\u7a7a\u6570\u636e\u5e93\u65b0\u5efaMetaData\u8868\uff0c\u5e76\u628aMigrations\u5e94\u7528\u5230\u8be5\u6570\u636e\u5e93\uff1b\u4e5f\u53ef\u4ee5\u5728\u5df2\u6709\u8868\u7ed3\u6784\u7684\u6570\u636e\u5e93\u4e2d\u5b9e\u73b0\u6dfb\u52a0Metadata\u8868\u3002<\/li><\/ul>\n\n\n\n<ul><li>clean\uff1a\u6e05\u9664\u6389\u5bf9\u5e94\u6570\u636e\u5e93Schema\u4e2d\u6240\u6709\u7684\u5bf9\u8c61\uff0c\u5305\u62ec\u8868\u7ed3\u6784\uff0c\u89c6\u56fe\uff0c\u5b58\u50a8\u8fc7\u7a0b\u7b49\uff0cclean\u64cd\u4f5c\u5728dev \u548c test\u9636\u6bb5\u5f88\u597d\u7528\uff0c\u4f46\u5728\u751f\u4ea7\u73af\u5883\u52a1\u5fc5\u7981\u7528\u3002<\/li><\/ul>\n\n\n\n<ul><li>info\uff1a\u7528\u4e8e\u6253\u5370\u6240\u6709\u7684Migrations\u7684\u8be6\u7ec6\u548c\u72b6\u6001\u4fe1\u606f\uff0c\u4e5f\u662f\u901a\u8fc7MetaData\u548cMigrations\u5b8c\u6210\u7684\uff0c\u53ef\u4ee5\u5feb\u901f\u5b9a\u4f4d\u5f53\u524d\u7684\u6570\u636e\u5e93\u7248\u672c\u3002<\/li><\/ul>\n\n\n\n<ul><li>repair\uff1arepair\u64cd\u4f5c\u80fd\u591f\u4fee\u590dmetaData\u8868\uff0c\u8be5\u64cd\u4f5c\u5728metadata\u51fa\u73b0\u9519\u8bef\u65f6\u5f88\u6709\u7528\u3002<\/li><\/ul>\n\n\n\n<ul><li>undo\uff1a\u64a4\u9500\u64cd\u4f5c\uff0c\u793e\u533a\u7248\u4e0d\u652f\u6301\u3002<\/li><\/ul>\n\n\n\n<ul><li>validate\uff1a\u9a8c\u8bc1\u5df2\u7ecfapply\u7684Migrations\u662f\u5426\u6709\u53d8\u66f4\uff0c\u9ed8\u8ba4\u5f00\u542f\u7684\uff0c\u539f\u7406\u662f\u5bf9\u6bd4MetaData\u8868\u4e0e\u672c\u5730Migrations\u7684checkNum\u503c\uff0c\u5982\u679c\u503c\u76f8\u540c\u5219\u9a8c\u8bc1\u901a\u8fc7\uff0c\u5426\u5219\u5931\u8d25\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u516d\u3001flyway\u77e5\u8bc6\u8865\u5145<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<ul><li>flyway\u6267\u884cmigrate\u5fc5\u987b\u5728\u7a7a\u767d\u7684\u6570\u636e\u5e93\u4e0a\u8fdb\u884c\uff0c\u5426\u5219\u62a5\u9519\u3002<\/li><li>\u5bf9\u4e8e\u5df2\u7ecf\u6709\u6570\u636e\u7684\u6570\u636e\u5e93\uff0c\u5fc5\u987b\u5148baseline\uff0c\u7136\u540e\u624d\u80fdmigrate\u3002<\/li><li>clean\u64cd\u4f5c\u662f\u5220\u9664\u6570\u636e\u5e93\u7684\u6240\u6709\u5185\u5bb9\uff0c\u5305\u62ecbaseline\u4e4b\u524d\u7684\u5185\u5bb9\u3002<\/li><li>\u5c3d\u91cf\u4e0d\u8981\u4fee\u6539\u5df2\u7ecf\u6267\u884c\u8fc7\u7684SQL\uff0c\u5373\u4fbf\u662fR\u5f00\u5934\u7684\u53ef\u53cd\u590d\u6267\u884c\u7684SQL\uff0c\u5b83\u4eec\u4f1a\u4e0d\u5229\u4e8e\u6570\u636e\u8fc1\u79fb\u3002<\/li><li>\u5f53\u9700\u8981\u505a\u6570\u636e\u8fc1\u79fb\u7684\u65f6\u5019\uff0c\u66f4\u6362\u4e00\u4e2a\u65b0\u7684\u7a7a\u767d\u6570\u636e\u5e93\uff0c\u6267\u884c\u4e0bmigrate\u547d\u4ee4\uff0c\u6240\u6709\u7684\u6570\u636e\u5e93\u66f4\u6539\u90fd\u53ef\u4ee5\u4e00\u6b65\u5230\u4f4d\u5730\u8fc1\u79fb\u8fc7\u53bb\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u4e03\u3001flyway\u914d\u7f6e\u6e05\u5355<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">flyway.baseline-description\u5bf9\u6267\u884c\u8fc1\u79fb\u65f6\u57fa\u51c6\u7248\u672c\u7684\u63cf\u8ff0.\nflyway.baseline-on-migrate\u5f53\u8fc1\u79fb\u65f6\u53d1\u73b0\u76ee\u6807schema\u975e\u7a7a\uff0c\u800c\u4e14\u5e26\u6709\u6ca1\u6709\u5143\u6570\u636e\u7684\u8868\u65f6\uff0c\u662f\u5426\u81ea\u52a8\u6267\u884c\u57fa\u51c6\u8fc1\u79fb\uff0c\u9ed8\u8ba4false.\nflyway.baseline-version\u5f00\u59cb\u6267\u884c\u57fa\u51c6\u8fc1\u79fb\u65f6\u5bf9\u73b0\u6709\u7684schema\u7684\u7248\u672c\u6253\u6807\u7b7e\uff0c\u9ed8\u8ba4\u503c\u4e3a1.\nflyway.check-location\u68c0\u67e5\u8fc1\u79fb\u811a\u672c\u7684\u4f4d\u7f6e\u662f\u5426\u5b58\u5728\uff0c\u9ed8\u8ba4false.\nflyway.clean-on-validation-error\u5f53\u53d1\u73b0\u6821\u9a8c\u9519\u8bef\u65f6\u662f\u5426\u81ea\u52a8\u8c03\u7528clean\uff0c\u9ed8\u8ba4false.\nflyway.enabled\u662f\u5426\u5f00\u542fflywary\uff0c\u9ed8\u8ba4true.\nflyway.encoding\u8bbe\u7f6e\u8fc1\u79fb\u65f6\u7684\u7f16\u7801\uff0c\u9ed8\u8ba4UTF-8.\nflyway.ignore-failed-future-migration\u5f53\u8bfb\u53d6\u5143\u6570\u636e\u8868\u65f6\u662f\u5426\u5ffd\u7565\u9519\u8bef\u7684\u8fc1\u79fb\uff0c\u9ed8\u8ba4false.\nflyway.init-sqls\u5f53\u521d\u59cb\u5316\u597d\u8fde\u63a5\u65f6\u8981\u6267\u884c\u7684SQL.\nflyway.locations\u8fc1\u79fb\u811a\u672c\u7684\u4f4d\u7f6e\uff0c\u9ed8\u8ba4db\/migration.\nflyway.out-of-order\u662f\u5426\u5141\u8bb8\u65e0\u5e8f\u7684\u8fc1\u79fb\uff0c\u9ed8\u8ba4false.\nflyway.password\u76ee\u6807\u6570\u636e\u5e93\u7684\u5bc6\u7801.\nflyway.placeholder-prefix\u8bbe\u7f6e\u6bcf\u4e2aplaceholder\u7684\u524d\u7f00\uff0c\u9ed8\u8ba4${.\nflyway.placeholder-replacementplaceholders\u662f\u5426\u8981\u88ab\u66ff\u6362\uff0c\u9ed8\u8ba4true.\nflyway.placeholder-suffix\u8bbe\u7f6e\u6bcf\u4e2aplaceholder\u7684\u540e\u7f00\uff0c\u9ed8\u8ba4}.\nflyway.placeholders.[placeholder name]\u8bbe\u7f6eplaceholder\u7684value\nflyway.schemas\u8bbe\u5b9a\u9700\u8981flywary\u8fc1\u79fb\u7684schema\uff0c\u5927\u5c0f\u5199\u654f\u611f\uff0c\u9ed8\u8ba4\u4e3a\u8fde\u63a5\u9ed8\u8ba4\u7684schema.\nflyway.sql-migration-prefix\u8fc1\u79fb\u6587\u4ef6\u7684\u524d\u7f00\uff0c\u9ed8\u8ba4\u4e3aV.\nflyway.sql-migration-separator\u8fc1\u79fb\u811a\u672c\u7684\u6587\u4ef6\u540d\u5206\u9694\u7b26\uff0c\u9ed8\u8ba4__\nflyway.sql-migration-suffix\u8fc1\u79fb\u811a\u672c\u7684\u540e\u7f00\uff0c\u9ed8\u8ba4\u4e3a.sql\nflyway.tableflyway\u4f7f\u7528\u7684\u5143\u6570\u636e\u8868\u540d\uff0c\u9ed8\u8ba4\u4e3aschema_version\nflyway.target\u8fc1\u79fb\u65f6\u4f7f\u7528\u7684\u76ee\u6807\u7248\u672c\uff0c\u9ed8\u8ba4\u4e3alatest version\nflyway.url\u8fc1\u79fb\u65f6\u4f7f\u7528\u7684JDBC URL\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u7684\u8bdd\uff0c\u5c06\u4f7f\u7528\u914d\u7f6e\u7684\u4e3b\u6570\u636e\u6e90\nflyway.user\u8fc1\u79fb\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\nflyway.validate-on-migrate\u8fc1\u79fb\u65f6\u662f\u5426\u6821\u9a8c\uff0c\u9ed8\u8ba4\u4e3atrue\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u7b80\u5355\u4ecb\u7ecd Flyway \u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u6570\u636e\u5e93\u7248\u672c\u7ba1\u7406\u5de5\u5177\u3002\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\uff0c\u6216\u8005\u5728Java\u5e94\u7528\u7a0b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,23],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9331"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9331"}],"version-history":[{"count":6,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9331\/revisions"}],"predecessor-version":[{"id":9340,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9331\/revisions\/9340"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}