{"id":376416,"date":"2024-05-21T06:50:17","date_gmt":"2024-05-21T06:50:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=376416"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=376416","title":{"rendered":"<span>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 YDB \u0441 Flyway \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041a\u0438\u0440\u0438\u043b\u043b \u041a\u0443\u0440\u0434\u044e\u043a\u043e\u0432, \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/ydb.tech\/\">YDB<\/a>. \u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/ydb\/articles\/808755\/\">\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e YDB c Liquibase<\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 <a href=\"https:\/\/documentation.red-gate.com\/fd\/\">Flyway<\/a> \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 YDB. <\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p><a href=\"https:\/\/documentation.red-gate.com\/fd\/\">Flyway<\/a>\u00a0\u2014 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f\u00a0\u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0441\u0445\u0435\u043c \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0421\u0423\u0411\u0414), \u0432\u043a\u043b\u044e\u0447\u0430\u044f YDB. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u00a0\u0436\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f\u00a0\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u0445\u0435\u043c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u0430\u043a\u00a0\u0438 Liquibase.<\/p>\n<p>Flyway \u0438 Liquibase \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043a\u0430\u043a\u0438\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u0432\u0435\u0434\u0443\u0442 \u0436\u0443\u0440\u043d\u0430\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e. \u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<h2>\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Flyway \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 YDB<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Flyway \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 YDB \u0432 Java \/ Kotlin \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0432 Gradle \/ Maven \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u0445, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Flyway \u0434\u043b\u044f YDB \u0438 <a href=\"https:\/\/github.com\/ydb-platform\/ydb-jdbc-driver\">YDB JDBC Driver<\/a>:<\/p>\n<p>Maven:<\/p>\n<pre><code class=\"xml\">&lt;!-- Set actual versions --> &lt;dependency>     &lt;groupId>org.flywaydb&lt;\/groupId>     &lt;artifactId>flyway-core&lt;\/artifactId>     &lt;version>${flyway.core.version}&lt;\/version> &lt;\/dependency>  &lt;dependency>     &lt;groupId>tech.ydb.jdbc&lt;\/groupId>     &lt;artifactId>ydb-jdbc-driver&lt;\/artifactId>     &lt;version>${ydb.jdbc.version}&lt;\/version> &lt;\/dependency>  &lt;dependency>     &lt;groupId>tech.ydb.dialects&lt;\/groupId>     &lt;artifactId>flyway-ydb-dialect&lt;\/artifactId>     &lt;version>${flyway.ydb.dialect.version}&lt;\/version> &lt;\/dependency><\/code><\/pre>\n<p> Gradle:<\/p>\n<pre><code class=\"kotlin\">dependencies {     \/\/ Set actual versions     implementation \"org.flywaydb:flyway-core:$flywayCoreVersion\"     implementation \"tech.ydb.dialects:flyway-ydb-dialect:$flywayYdbDialecVersion\"     implementation \"tech.ydb.jdbc:ydb-jdbc-driver:$ydbJdbcVersion\" }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 YDB \u0447\u0435\u0440\u0435\u0437 Flyway CLI \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>flyway<\/code> <a href=\"https:\/\/documentation.red-gate.com\/fd\/command-line-184127404.html\">\u043b\u044e\u0431\u044b\u043c \u0438\u0437 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432<\/a>.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c Flyway \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u0438\u0430\u043b\u0435\u043a\u0442\u043e\u043c YDB \u0438 JDBC-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c:<\/p>\n<pre><code class=\"bash\"># install flyway # cd $(which flyway) \/\/ prepare this command for your environment  cd libexec # set actual versions .jar files  cd drivers &amp;&amp; curl -L -o ydb-jdbc-driver-shaded-2.1.0.jar https:\/\/repo.maven.apache.org\/maven2\/tech\/ydb\/jdbc\/ydb-jdbc-driver-shaded\/2.1.0\/ydb-jdbc-driver-shaded-2.1.0.jar  cd ..\/lib &amp;&amp; curl -L -o flyway-ydb-dialect.jar https:\/\/repo.maven.apache.org\/maven2\/tech\/ydb\/dialects\/flyway-ydb-dialect\/1.0.0-RC0\/flyway-ydb-dialect-1.0.0-RC0.jar<\/code><\/pre>\n<h2>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Flyway<\/h2>\n<h3>baseline<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-baseline\">baseline<\/a> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 Flyway \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e <code>baselineVersion<\/code> \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e. <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8e5\/964\/e6e\/8e5964e6e5d19a0c1b97e79c24d4abec.png\" alt=\"\" title=\"\" width=\"313\" height=\"257\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8e5\/964\/e6e\/8e5964e6e5d19a0c1b97e79c24d4abec.png\"\/><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u0437\u044f\u0442\u044b \u0438\u0437 <a href=\"https:\/\/ydb.tech\/docs\/ru\/dev\/yql-tutorial\/create_demo_tables\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/a>): <\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c <code>baselineVersion = 3<\/code>, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration -baselineVersion=3 baseline<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 <code>flyway_schema_history<\/code> \u0441 <code>baseline<\/code> \u0437\u0430\u043f\u0438\u0441\u044c\u044e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d89\/c24\/64c\/d89c2464c3496634eeca8f48bedb7a6e.png\" alt=\"\u0421\u043e\u0437\u0434\u0430\u043d\u0430 baseline \u0437\u0430\u043f\u0438\u0441\u044c\" title=\"\u0421\u043e\u0437\u0434\u0430\u043d\u0430 baseline \u0437\u0430\u043f\u0438\u0441\u044c\" width=\"1604\" height=\"688\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d89\/c24\/64c\/d89c2464c3496634eeca8f48bedb7a6e.png\"\/><\/p>\n<div><figcaption>\u0421\u043e\u0437\u0434\u0430\u043d\u0430 <code>baseline<\/code> \u0437\u0430\u043f\u0438\u0441\u044c<\/figcaption><\/div>\n<\/figure>\n<h3>migrate<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-migrate\">migrate<\/a> \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0415\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0442\u043e Flyway \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0435\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e <a href=\"https:\/\/ydb.tech\/docs\/ru\/dev\/yql-tutorial\/fill_tables_with_data\">\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/a>:<\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql   V4__load_data.sql<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration migrate<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>series<\/code>, <code>seasons<\/code> \u0438 <code>episodes<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bcc\/e42\/4d9\/bcce424d9d7524db844a17e5bafc8afa.png\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"866\" height=\"539\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bcc\/e42\/4d9\/bcce424d9d7524db844a17e5bafc8afa.png\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0441\u0445\u0435\u043c\u0443 \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/ydb.tech\/docs\/ru\/yql\/reference\/syntax\/alter_table\">\u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/a>:<\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql   V4__load_data.sql   V5__create_series_title_index.sql<\/code><\/pre>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>V5__create_series_title_index.sql<\/code>:<\/p>\n<pre><code class=\"sql\">ALTER TABLE `series` ADD INDEX `title_index` GLOBAL ON (`title`);<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration migrate<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>series<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/368\/e32\/929\/368e329299272c1707b86dbaefa67131.png\" alt=\"C\u043e\u0437\u0434\u0430\u043d \u0438\u043d\u0434\u0435\u043a\u0441 title_index \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b series \" title=\"C\u043e\u0437\u0434\u0430\u043d \u0438\u043d\u0434\u0435\u043a\u0441 title_index \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b series \" width=\"1851\" height=\"529\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/368\/e32\/929\/368e329299272c1707b86dbaefa67131.png\"\/><\/p>\n<div><figcaption>C\u043e\u0437\u0434\u0430\u043d \u0438\u043d\u0434\u0435\u043a\u0441 <code>title_index<\/code> \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>series<\/code> <\/figcaption><\/div>\n<\/figure>\n<h3>info<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-info\">info<\/a> \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u043d\u043d\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441:<\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql   V4__load_data.sql   V5__create_series_title_index.sql   V6__rename_series_title_index.sql<\/code><\/pre>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>V6__rename_series_title_index.sql<\/code>:<\/p>\n<pre><code class=\"sql\">ALTER TABLE `series` RENAME INDEX `title_index` TO `title_index_new`;<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration info<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>+-----------+---------+---------------------------+----------+---------------------+--------------------+----------+ | Category  | Version | Description               | Type     | Installed On        | State              | Undoable | +-----------+---------+---------------------------+----------+---------------------+--------------------+----------+ | Versioned | 1       | create series             | SQL      |                     | Below Baseline     | No       | | Versioned | 2       | create seasons            | SQL      |                     | Below Baseline     | No       | | Versioned | 3       | create episodes           | SQL      |                     | Ignored (Baseline) | No       | |           | 3       | &lt;&lt; Flyway Baseline >>     | BASELINE | 2024-04-16 12:09:27 | Baseline           | No       | | Versioned | 4       | load data                 | SQL      | 2024-04-16 12:35:12 | Success            | No       | | Versioned | 5       | create series title index | SQL      | 2024-04-16 12:59:20 | Success            | No       | | Versioned | 6       | rename series title index | SQL      |                     | Pending            | No       | +-----------+---------+---------------------------+----------+---------------------+--------------------+----------+<\/code><\/pre>\n<h3>validate<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-validate\">validate<\/a> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u043a \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration validate<\/code><\/pre>\n<p>\u0412 \u043b\u043e\u0433\u0430\u0445 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"diff\">ERROR: Validate failed: Migrations have failed validation Detected resolved migration not applied to database: 6. To fix this error, either run migrate, or set -ignoreMigrationPatterns='*:pending'.<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 <code>flyway .. migrate<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 <code>V4__load_date.sql<\/code>, \u0443\u0434\u0430\u043b\u0438\u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0432 SQL-\u0441\u043a\u0440\u0438\u043f\u0442\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <code>checksum<\/code> \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>ERROR: Validate failed: Migrations have failed validation Migration checksum mismatch for migration version 4 -> Applied to database : 591649768 -> Resolved locally    : 1923849782<\/code><\/pre>\n<h3>repair<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-repair\">repair<\/a> \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0423\u0441\u0442\u0440\u0430\u043d\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 <code>checksum<\/code>, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration repair<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 <code>checksum<\/code> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>flyway_schema_history<\/code> \u0443 \u0437\u0430\u043f\u0438\u0441\u0438, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0439 \u0437\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e <code>V4__load_data.sql<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ba7\/9fa\/c0b\/ba79fac0b9bfe5d3d9a428f5f425fb0e.png\" alt=\"\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435 checksum\" title=\"\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435 checksum\" width=\"711\" height=\"578\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ba7\/9fa\/c0b\/ba79fac0b9bfe5d3d9a428f5f425fb0e.png\"\/><\/p>\n<div><figcaption>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>checksum<\/code><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043b\u043e\u0433\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>repair<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u0443\u0434\u0430\u0432\u0448\u0438\u0439\u0441\u044f DDL-\u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<h3>clean<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-clean\">clean<\/a> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0441\u0445\u0435\u043c\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0421\u0423\u0411\u0414 YDB \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a <code>schema<\/code>, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>clean<\/code> \u0443\u0434\u0430\u043b\u0438\u0442 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0432\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration -cleanDisabled=false clean<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fbc\/d49\/adf\/fbcd49adf4a80fdefa1b6851be143855.png\" alt=\"\u041f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u041f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"314\" height=\"212\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fbc\/d49\/adf\/fbcd49adf4a80fdefa1b6851be143855.png\"\/><\/p>\n<div><figcaption>\u041f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<h2>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432 Flyway<\/h2>\n<p>\u041f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, Flyway \u0431\u0435\u0440\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0421\u0423\u0411\u0414 \u0441\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. <\/p>\n<p>\u0412 Oracle \u0438 Derby:<\/p>\n<pre><code class=\"sql\">LOCK TABLE flyway_history_schema IN EXCLUSIVE MODE<\/code><\/pre>\n<p>\u0412 PostgreSQL:<\/p>\n<pre><code class=\"sql\">SELECT pg_try_advisory_xact_lock(\"flyway1\")<\/code><\/pre>\n<p>\u0414\u043b\u044f YDB \u0432\u0437\u044f\u0442\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434 <a href=\"https:\/\/github.com\/flyway\/flyway\/blob\/main\/flyway-core\/src\/main\/java\/org\/flywaydb\/core\/internal\/database\/InsertRowLock.java\">CockroachDB, Google Spanner<\/a> \u0438\u043b\u0438 Apache Ignite. <\/p>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 <code>flyway_schema_history<\/code> \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c c ID = -100:<\/p>\n<pre><code class=\"sql\">INSERT INTO flyway_schema_history(installed_rank, version, description) VALUES (-100, $tableLockId, 'flyway-lock')<\/code><\/pre>\n<p>\u0418 \u043a\u0442\u043e \u0443\u0441\u043f\u0435\u043b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u0442\u043e\u0442 \u0438 \u043b\u0438\u0434\u0435\u0440. <\/p>\n<p>\u041e\u0442\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 SQL-\u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"sql\">DELETE FROM flyway_schema_history FROM installed_rank = -100<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c \u043e\u0442 CockroachDB \u0438 Google Spanner \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u0439\u043c-\u0430\u0443\u0442 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438, \u0430 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f DBA, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 Apache Ignite. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u0432 \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0442\u043a\u0430\u0437\u0430\u043b \u043b\u0438\u0434\u0435\u0440 \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043d\u0430\u0448\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0410 \u0435\u0449\u0435 <a href=\"https:\/\/github.com\/flyway\/flyway\/blob\/main\/flyway-core\/src\/main\/java\/org\/flywaydb\/core\/internal\/database\/InsertRowLock.java#L48\">ScheduledThreadPool \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/a>, \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. <\/p>\n<h2>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0438\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u044f \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0434\u0438\u0430\u043b\u0435\u043a\u0442\u0430 YDB, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c issue \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/ydb-platform\/ydb-java-dialects\">ydb-java-dialects<\/a> \u0441 \u0442\u0435\u0433\u043e\u043c <code>flyway<\/code>. <\/p>\n<p>\u041b\u0438\u0431\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0435\u0451 \u0432 <a href=\"https:\/\/t.me\/ydb_ru\">\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 Telegram \u0447\u0430\u0442 YDB<\/a>.<\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e Flyway \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e <a href=\"https:\/\/ydb.tech\/docs\/ru\/integrations\/flyway\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/815085\/\"> https:\/\/habr.com\/ru\/articles\/815085\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041a\u0438\u0440\u0438\u043b\u043b \u041a\u0443\u0440\u0434\u044e\u043a\u043e\u0432, \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/ydb.tech\/\">YDB<\/a>. \u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/ydb\/articles\/808755\/\">\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e YDB c Liquibase<\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 <a href=\"https:\/\/documentation.red-gate.com\/fd\/\">Flyway<\/a> \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 YDB. <\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p><a href=\"https:\/\/documentation.red-gate.com\/fd\/\">Flyway<\/a>\u00a0\u2014 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f\u00a0\u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0441\u0445\u0435\u043c \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0421\u0423\u0411\u0414), \u0432\u043a\u043b\u044e\u0447\u0430\u044f YDB. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u00a0\u0436\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f\u00a0\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u0445\u0435\u043c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u0430\u043a\u00a0\u0438 Liquibase.<\/p>\n<p>Flyway \u0438 Liquibase \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043a\u0430\u043a\u0438\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u0432\u0435\u0434\u0443\u0442 \u0436\u0443\u0440\u043d\u0430\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e. \u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<h2>\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Flyway \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 YDB<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Flyway \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 YDB \u0432 Java \/ Kotlin \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0432 Gradle \/ Maven \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u0445, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Flyway \u0434\u043b\u044f YDB \u0438 <a href=\"https:\/\/github.com\/ydb-platform\/ydb-jdbc-driver\">YDB JDBC Driver<\/a>:<\/p>\n<p>Maven:<\/p>\n<pre><code class=\"xml\">&lt;!-- Set actual versions --> &lt;dependency>     &lt;groupId>org.flywaydb&lt;\/groupId>     &lt;artifactId>flyway-core&lt;\/artifactId>     &lt;version>${flyway.core.version}&lt;\/version> &lt;\/dependency>  &lt;dependency>     &lt;groupId>tech.ydb.jdbc&lt;\/groupId>     &lt;artifactId>ydb-jdbc-driver&lt;\/artifactId>     &lt;version>${ydb.jdbc.version}&lt;\/version> &lt;\/dependency>  &lt;dependency>     &lt;groupId>tech.ydb.dialects&lt;\/groupId>     &lt;artifactId>flyway-ydb-dialect&lt;\/artifactId>     &lt;version>${flyway.ydb.dialect.version}&lt;\/version> &lt;\/dependency><\/code><\/pre>\n<p> Gradle:<\/p>\n<pre><code class=\"kotlin\">dependencies {     \/\/ Set actual versions     implementation \"org.flywaydb:flyway-core:$flywayCoreVersion\"     implementation \"tech.ydb.dialects:flyway-ydb-dialect:$flywayYdbDialecVersion\"     implementation \"tech.ydb.jdbc:ydb-jdbc-driver:$ydbJdbcVersion\" }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 YDB \u0447\u0435\u0440\u0435\u0437 Flyway CLI \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>flyway<\/code> <a href=\"https:\/\/documentation.red-gate.com\/fd\/command-line-184127404.html\">\u043b\u044e\u0431\u044b\u043c \u0438\u0437 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432<\/a>.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c Flyway \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u0438\u0430\u043b\u0435\u043a\u0442\u043e\u043c YDB \u0438 JDBC-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c:<\/p>\n<pre><code class=\"bash\"># install flyway # cd $(which flyway) \/\/ prepare this command for your environment  cd libexec # set actual versions .jar files  cd drivers &amp;&amp; curl -L -o ydb-jdbc-driver-shaded-2.1.0.jar https:\/\/repo.maven.apache.org\/maven2\/tech\/ydb\/jdbc\/ydb-jdbc-driver-shaded\/2.1.0\/ydb-jdbc-driver-shaded-2.1.0.jar  cd ..\/lib &amp;&amp; curl -L -o flyway-ydb-dialect.jar https:\/\/repo.maven.apache.org\/maven2\/tech\/ydb\/dialects\/flyway-ydb-dialect\/1.0.0-RC0\/flyway-ydb-dialect-1.0.0-RC0.jar<\/code><\/pre>\n<h2>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Flyway<\/h2>\n<h3>baseline<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-baseline\">baseline<\/a> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 Flyway \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e <code>baselineVersion<\/code> \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e. <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u0437\u044f\u0442\u044b \u0438\u0437 <a href=\"https:\/\/ydb.tech\/docs\/ru\/dev\/yql-tutorial\/create_demo_tables\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/a>): <\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c <code>baselineVersion = 3<\/code>, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration -baselineVersion=3 baseline<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 <code>flyway_schema_history<\/code> \u0441 <code>baseline<\/code> \u0437\u0430\u043f\u0438\u0441\u044c\u044e:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043e\u0437\u0434\u0430\u043d\u0430 <code>baseline<\/code> \u0437\u0430\u043f\u0438\u0441\u044c<\/figcaption><\/div>\n<\/figure>\n<h3>migrate<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-migrate\">migrate<\/a> \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0415\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0442\u043e Flyway \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0435\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e <a href=\"https:\/\/ydb.tech\/docs\/ru\/dev\/yql-tutorial\/fill_tables_with_data\">\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/a>:<\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql   V4__load_data.sql<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration migrate<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>series<\/code>, <code>seasons<\/code> \u0438 <code>episodes<\/code>:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0441\u0445\u0435\u043c\u0443 \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/ydb.tech\/docs\/ru\/yql\/reference\/syntax\/alter_table\">\u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/a>:<\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql   V4__load_data.sql   V5__create_series_title_index.sql<\/code><\/pre>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>V5__create_series_title_index.sql<\/code>:<\/p>\n<pre><code class=\"sql\">ALTER TABLE `series` ADD INDEX `title_index` GLOBAL ON (`title`);<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration migrate<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>series<\/code>:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>C\u043e\u0437\u0434\u0430\u043d \u0438\u043d\u0434\u0435\u043a\u0441 <code>title_index<\/code> \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>series<\/code> <\/figcaption><\/div>\n<\/figure>\n<h3>info<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-info\">info<\/a> \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u043d\u043d\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441:<\/p>\n<pre><code>db\/migration:   V1__create_series.sql   V2__create_seasons.sql   V3__create_episodes.sql   V4__load_data.sql   V5__create_series_title_index.sql   V6__rename_series_title_index.sql<\/code><\/pre>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>V6__rename_series_title_index.sql<\/code>:<\/p>\n<pre><code class=\"sql\">ALTER TABLE `series` RENAME INDEX `title_index` TO `title_index_new`;<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration info<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>+-----------+---------+---------------------------+----------+---------------------+--------------------+----------+ | Category  | Version | Description               | Type     | Installed On        | State              | Undoable | +-----------+---------+---------------------------+----------+---------------------+--------------------+----------+ | Versioned | 1       | create series             | SQL      |                     | Below Baseline     | No       | | Versioned | 2       | create seasons            | SQL      |                     | Below Baseline     | No       | | Versioned | 3       | create episodes           | SQL      |                     | Ignored (Baseline) | No       | |           | 3       | &lt;&lt; Flyway Baseline >>     | BASELINE | 2024-04-16 12:09:27 | Baseline           | No       | | Versioned | 4       | load data                 | SQL      | 2024-04-16 12:35:12 | Success            | No       | | Versioned | 5       | create series title index | SQL      | 2024-04-16 12:59:20 | Success            | No       | | Versioned | 6       | rename series title index | SQL      |                     | Pending            | No       | +-----------+---------+---------------------------+----------+---------------------+--------------------+----------+<\/code><\/pre>\n<h3>validate<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-validate\">validate<\/a> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u043a \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration validate<\/code><\/pre>\n<p>\u0412 \u043b\u043e\u0433\u0430\u0445 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"diff\">ERROR: Validate failed: Migrations have failed validation Detected resolved migration not applied to database: 6. To fix this error, either run migrate, or set -ignoreMigrationPatterns='*:pending'.<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 <code>flyway .. migrate<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 <code>V4__load_date.sql<\/code>, \u0443\u0434\u0430\u043b\u0438\u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0432 SQL-\u0441\u043a\u0440\u0438\u043f\u0442\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <code>checksum<\/code> \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>ERROR: Validate failed: Migrations have failed validation Migration checksum mismatch for migration version 4 -> Applied to database : 591649768 -> Resolved locally    : 1923849782<\/code><\/pre>\n<h3>repair<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-repair\">repair<\/a> \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0423\u0441\u0442\u0440\u0430\u043d\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 <code>checksum<\/code>, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration repair<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 <code>checksum<\/code> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>flyway_schema_history<\/code> \u0443 \u0437\u0430\u043f\u0438\u0441\u0438, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0439 \u0437\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e <code>V4__load_data.sql<\/code>:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>checksum<\/code><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043b\u043e\u0433\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>repair<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u0443\u0434\u0430\u0432\u0448\u0438\u0439\u0441\u044f DDL-\u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<h3>clean<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/documentation.red-gate.com\/flyway\/flyway-cli-and-api\/usage\/command-line\/command-line-clean\">clean<\/a> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0441\u0445\u0435\u043c\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0421\u0423\u0411\u0414 YDB \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a <code>schema<\/code>, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>clean<\/code> \u0443\u0434\u0430\u043b\u0438\u0442 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0432\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">flyway -url=jdbc:ydb:grpc:\/\/localhost:2136\/local -locations=db\/migration -cleanDisabled=false clean<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<figure class=\"\">\n<div><figcaption>\u041f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<h2>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432 Flyway<\/h2>\n<p>\u041f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, Flyway \u0431\u0435\u0440\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0421\u0423\u0411\u0414 \u0441\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. <\/p>\n<p>\u0412 Oracle \u0438 Derby:<\/p>\n<pre><code class=\"sql\">LOCK TABLE flyway_history_schema IN EXCLUSIVE MODE<\/code><\/pre>\n<p>\u0412 PostgreSQL:<\/p>\n<pre><code class=\"sql\">SELECT pg_try_advisory_xact_lock(\"flyway1\")<\/code><\/pre>\n<p>\u0414\u043b\u044f YDB \u0432\u0437\u044f\u0442\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434 <a href=\"https:\/\/github.com\/flyway\/flyway\/blob\/main\/flyway-core\/src\/main\/java\/org\/flywaydb\/core\/internal\/database\/InsertRowLock.java\">CockroachDB, Google Spanner<\/a> \u0438\u043b\u0438 Apache Ignite. <\/p>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 <code>flyway_schema_history<\/code> \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c c ID = -100:<\/p>\n<pre><code class=\"sql\">INSERT INTO flyway_schema_history(installed_rank, version, description) VALUES (-100, $tableLockId, 'flyway-lock')<\/code><\/pre>\n<p>\u0418 \u043a\u0442\u043e \u0443\u0441\u043f\u0435\u043b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u0442\u043e\u0442 \u0438 \u043b\u0438\u0434\u0435\u0440. <\/p>\n<p>\u041e\u0442\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 SQL-\u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"sql\">DELETE FROM flyway_schema_history FROM installed_rank = -100<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c \u043e\u0442 CockroachDB \u0438 Google Spanner \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u0439\u043c-\u0430\u0443\u0442 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438, \u0430 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f DBA, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 Apache Ignite. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u0432 \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0442\u043a\u0430\u0437\u0430\u043b \u043b\u0438\u0434\u0435\u0440 \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043d\u0430\u0448\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0410 \u0435\u0449\u0435 <a href=\"https:\/\/github.com\/flyway\/flyway\/blob\/main\/flyway-core\/src\/main\/java\/org\/flywaydb\/core\/internal\/database\/InsertRowLock.java#L48\">ScheduledThreadPool \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/a>, \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. <\/p>\n<h2>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0438\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u044f \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0434\u0438\u0430\u043b\u0435\u043a\u0442\u0430 YDB, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c issue \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/ydb-platform\/ydb-java-dialects\">ydb-java-dialects<\/a> \u0441 \u0442\u0435\u0433\u043e\u043c <code>flyway<\/code>. <\/p>\n<p>\u041b\u0438\u0431\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0435\u0451 \u0432 <a href=\"https:\/\/t.me\/ydb_ru\">\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 Telegram \u0447\u0430\u0442 YDB<\/a>.<\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e Flyway \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e <a href=\"https:\/\/ydb.tech\/docs\/ru\/integrations\/flyway\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/815085\/\"><\/a><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-376416","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=376416"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376416\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=376416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=376416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=376416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}