{"id":403046,"date":"2024-06-29T16:52:58","date_gmt":"2024-06-29T16:52:58","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=403046"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=403046","title":{"rendered":"<span>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 changeSet&#8217;\u043e\u0432 Liquibase \u0438\u0437 Java entity<\/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 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f: \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438 \u0442.\u0434. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 Liquibase. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0448\u0430\u0435\u0442, \u043d\u0430\u0434\u043e \u043b\u0438 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0438\u043b\u0438 \u0436\u0435 \u043e\u043d\u0438 \u0432 \u043d\u0435\u0439 \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 Entity \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 changeSet. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u044f \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442 changeSet\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0435\u0439 Entity \u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445?<\/p>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f java, spring, gradle \u0438 liquibase plugin.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <em>lombok<\/em>, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e. \u0421\u0423\u0411\u0414 &#8212; PostgreSQL.<\/p>\n<h2>\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u0430\u0440\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 Entity.<\/p>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n<pre><code class=\"java\">import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp;  import javax.persistence.*; import java.time.OffsetDateTime;  @Data @NoArgsConstructor @MappedSuperclass public class BaseEntity {      @Id     @GeneratedValue(strategy = GenerationType.IDENTITY)     @Column     private Long id;      @CreationTimestamp     @Column(updatable = false, nullable = false)     private OffsetDateTime createDate;      @UpdateTimestamp     @Column(nullable = false)     private OffsetDateTime updateDate; }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0445\u043e\u0437\u044f\u0438\u043d\u0430:<\/p>\n<pre><code class=\"java\">import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor;  import javax.persistence.*; import java.util.ArrayList; import java.util.List;  @Data @NoArgsConstructor @Entity @Table(name = \"person\") @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class PersonEntity extends BaseEntity {      @Column     private String name;      @OneToMany(mappedBy = \"owner\", cascade = CascadeType.ALL, orphanRemoval = true)   @EqualsAndHashCode.Exclude     @ToString.Exclude     private List&lt;AnimalEntity> animals = new ArrayList&lt;>(); } <\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435:<\/p>\n<pre><code class=\"java\">import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor;  import javax.persistence.*;  @Data @NoArgsConstructor @Entity @Table(name = \"animal\") @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class AnimalEntity extends BaseEntity {      @Column     private String name;      @Column     private Long age;      @Column(updatable = false, nullable = false)     @Enumerated     private AnimalType type;      @ManyToOne(fetch = FetchType.LAZY)     @JoinColumn(foreignKey = @ForeignKey(name = \"animal_person_fk01\")) @EqualsAndHashCode.Exclude     @ToString.Exclude     private PersonEntity owner; } <\/code><\/pre>\n<p>\u0418 \u0442\u0438\u043f \u0434\u043b\u044f \u0436\u0432\u043e\u0442\u043d\u043e\u0433\u043e:<\/p>\n<pre><code class=\"java\">public enum AnimalType {     CAT,     DOG,     BIRD,     HORSE } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u044f\u043d\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>gradle build<\/code>. \u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f <em>build<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c  \u0432 \u0444\u0430\u0439\u043b\u0435 <em>build.gradle<\/em> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <a href=\"https:\/\/github.com\/liquibase\/liquibase-gradle-plugin\" rel=\"noopener noreferrer nofollow\">\u043f\u043b\u0430\u0433\u0438\u043d<\/a><\/p>\n<pre><code class=\"json\">plugins { id 'org.liquibase.gradle' version '2.0.' }<\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u044e \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043a \u0431\u0434 \u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448\u0438 entity:<\/p>\n<pre><code class=\"json\">liquibase {     activities {         main {             changeLogFile \"$buildDir\/generated-migrations.yaml\" \/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0434\u0430 \u0438 \u0441 \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b             \/\/\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0434   url \"jdbc:postgresql:\/\/localhost:5432\/testDb\"             username \"test\"             password \"test\" \/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a entity, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f hibernate(\u0434\u0438\u0430\u043b\u0435\u043a\u0442, \u0441\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f)             referenceUrl 'hibernate:spring:entity?dialect=org.hibernate.dialect.PostgreSQL10Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'   logLevel 'debug' \/\/\u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u043c \u0432\u0438\u0434\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434         }         runList = \"main\"     } } <\/code><\/pre>\n<p>\u041f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 hibernate \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/proselyte.net\/tutorials\/hibernate-tutorial\/configure\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>, \u0430 \u043f\u0440\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/351380\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u0442 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a>.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0434 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<pre><code class=\"json\"> ext {     database = new Properties().with {         load(file(\"db.properties\").newReader()) \/\/\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0431\u0434         it     } }<\/code><\/pre>\n<pre><code class=\"json\">liquibase {     activities {         main {             changeLogFile \"$buildDir\/generated-migrations.yaml\"                       \/\/\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0430 \u043d\u0435 \u0441\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f             url database.getProperty(\"dbUrl\")             username database.getProperty(\"dbUsername\")             password database.getProperty(\"dbPassword\")             referenceUrl 'hibernate:spring:entity?dialect=org.hibernate.dialect.PostgreSQL10Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'         }         runList = \"main\"     } }<\/code><\/pre>\n<p>\u0421\u0430\u043c \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 <em>db.properties<\/em><\/p>\n<pre><code class=\"json\">dbUrl=jdbc:postgresql:\/\/localhost:5432\/testDb dbUsername=test dbPassword=test <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0443 \u043d\u0443\u0436\u043d\u044b \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0431, \u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0434\u043b\u044f \u0447\u0435\u043d\u0434\u0436\u043b\u043e\u0433\u0430 \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"json\">liquibaseRuntime 'org.liquibase:liquibase-core:3.8.9' liquibaseRuntime(\"ch.qos.logback:logback-core:1.2.3\") liquibaseRuntime(\"ch.qos.logback:logback-classic:1.2.3\") \/\/\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0411\u0414 liquibaseRuntime 'org.postgresql:postgresql' \/\/hibernate &amp; spring &amp; jpa liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:3.6' liquibaseRuntime 'org.springframework.data:spring-data-jpa' liquibaseRuntime 'org.springframework.boot:spring-boot' liquibaseRuntime sourceSets.main.output \/\/\u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 yaml liquibaseRuntime 'org.yaml:snakeyaml:1.26'<\/code><\/pre>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>liquibaseRuntime sourceSets.main.output<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043b\u0430\u0433\u0438\u043d \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 entity.<\/p>\n<h2>\u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u0411\u0414<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0411\u0414. \u042f \u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u0432 \u0434\u043e\u043a\u0435\u0440\u0435, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430 \u0441\u0432\u043e\u0439 \u043f\u043a.<\/p>\n<pre><code class=\"yaml\">version: \"3.5\" services:    db:     ports:       - 5432:5432     image: postgres:12     environment:       POSTGRES_DB: testDb       POSTGRES_USER: test       POSTGRES_PASSWORD: test <\/code><\/pre>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0438\u043c changeSet&#8217;\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>diffChangeLog<\/code> <\/p>\n<p>\u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0431\u0438\u043b\u0434 \u0443 \u043d\u0430\u0441 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b <em>changelog.yaml<\/em> \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c\u0438 changeSet&#8217;\u0430\u043c\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"yaml\">databaseChangeLog:   - changeSet:       id: 1638648715035-1       author: AnnKont (generated)       changes:         - createTable:             columns:               - column:                   autoIncrement: true                   constraints:                     nullable: false                     primaryKey: true                     primaryKeyName: animalPK                   name: id                   type: BIGINT               - column:                   constraints:                     nullable: false                   name: create_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   constraints:                     nullable: false                   name: update_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   name: age                   type: BIGINT               - column:                   name: name                   type: VARCHAR(255)               - column:                   constraints:                     nullable: false                   name: type                   type: INTEGER               - column:                   name: owner_id                   type: BIGINT             tableName: animal   - changeSet:       id: 1638648715035-2       author: AnnKont (generated)       changes:         - createTable:             columns:               - column:                   autoIncrement: true                   constraints:                     nullable: false                     primaryKey: true                     primaryKeyName: personPK                   name: id                   type: BIGINT               - column:                   constraints:                     nullable: false                   name: create_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   constraints:                     nullable: false                   name: update_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   name: name                   type: VARCHAR(255)             tableName: person   - changeSet:       id: 1638648715035-3       author: AnnKont (generated)       changes:         - addForeignKeyConstraint:             baseColumnNames: owner_id             baseTableName: animal             constraintName: animal_person_fk01             deferrable: false             initiallyDeferred: false             referencedColumnNames: id             referencedTableName: person             validate: true<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <code>db.changelog<\/code> \u0438 \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0441\u043c\u0435\u043b\u043e \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 entity. \u0418 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u043c <code>clean<\/code> \u0438 <code>build<\/code>.<\/p>\n<pre><code class=\"java\">public class PersonEntity extends BaseEntity { \/\/\u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 name \u043d\u0430 firstName     @Column     private String firstName; \/\/\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443     @Column     private String secondName;  ... } <\/code><\/pre>\n<pre><code class=\"java\">public class AnimalEntity extends BaseEntity { \/\/\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435     @Column(nullable = false)     private String name; ... }<\/code><\/pre>\n<p>\u0421\u043d\u043e\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>diffChangeLog<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 changeSet&#8217;\u044b<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>databaseChangeLog:   - changeSet:       id: 1638650678646-1       author: AnnKont (generated)       changes:         - addNotNullConstraint:             columnDataType: varchar(255)             columnName: name             tableName: animal             validate: true   - changeSet:       id: 1638650678646-2       author: AnnKont (generated)       changes:         - addColumn:             columns:               - column:                   name: first_name                   type: varchar(255)             tableName: person   - changeSet:       id: 1638650678646-3       author: AnnKont (generated)       changes:         - addColumn:             columns:               - column:                   name: second_name                   type: varchar(255)             tableName: person   - changeSet:       id: 1638650678646-4       author: AnnKont (generated)       changes:         - dropColumn:             columnName: name             tableName: person<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0434\u0440\u0443\u0433\u0443\u044e, \u0442\u043e \u0442\u0443\u0442 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0440\u0443\u043a\u0430\u043c\u0438.<br \/>\u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0437\u0430\u043c\u0435\u043d\u0430 <em>name<\/em> \u043d\u0430 <em>firstName<\/em> != \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u041f\u043b\u0430\u0433\u0438\u043d \u0434\u0443\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <em>name<\/em> \u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <em>firstName<\/em>.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 <a href=\"https:\/\/github.com\/AnnKont\/liquibase-example\" rel=\"noopener noreferrer nofollow\">github<\/a>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>Liquibase plugin \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 changLog&#8217;\u043e\u0432, \u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u043c\u0443 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043e\u043d \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u0430. \u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u0433\u043b\u0430\u0437\u0430\u043c\u0438 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443, \u0438 \u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<\/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\/589205\/\"> https:\/\/habr.com\/ru\/articles\/589205\/<\/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 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f: \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438 \u0442.\u0434. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 Liquibase. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0448\u0430\u0435\u0442, \u043d\u0430\u0434\u043e \u043b\u0438 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0438\u043b\u0438 \u0436\u0435 \u043e\u043d\u0438 \u0432 \u043d\u0435\u0439 \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 Entity \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 changeSet. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u044f \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442 changeSet\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0435\u0439 Entity \u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445?<\/p>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f java, spring, gradle \u0438 liquibase plugin.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <em>lombok<\/em>, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e. \u0421\u0423\u0411\u0414 &#8212; PostgreSQL.<\/p>\n<h2>\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u0430\u0440\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 Entity.<\/p>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n<pre><code class=\"java\">import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp;  import javax.persistence.*; import java.time.OffsetDateTime;  @Data @NoArgsConstructor @MappedSuperclass public class BaseEntity {      @Id     @GeneratedValue(strategy = GenerationType.IDENTITY)     @Column     private Long id;      @CreationTimestamp     @Column(updatable = false, nullable = false)     private OffsetDateTime createDate;      @UpdateTimestamp     @Column(nullable = false)     private OffsetDateTime updateDate; }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0445\u043e\u0437\u044f\u0438\u043d\u0430:<\/p>\n<pre><code class=\"java\">import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor;  import javax.persistence.*; import java.util.ArrayList; import java.util.List;  @Data @NoArgsConstructor @Entity @Table(name = \"person\") @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class PersonEntity extends BaseEntity {      @Column     private String name;      @OneToMany(mappedBy = \"owner\", cascade = CascadeType.ALL, orphanRemoval = true)   @EqualsAndHashCode.Exclude     @ToString.Exclude     private List&lt;AnimalEntity> animals = new ArrayList&lt;>(); } <\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435:<\/p>\n<pre><code class=\"java\">import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor;  import javax.persistence.*;  @Data @NoArgsConstructor @Entity @Table(name = \"animal\") @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class AnimalEntity extends BaseEntity {      @Column     private String name;      @Column     private Long age;      @Column(updatable = false, nullable = false)     @Enumerated     private AnimalType type;      @ManyToOne(fetch = FetchType.LAZY)     @JoinColumn(foreignKey = @ForeignKey(name = \"animal_person_fk01\")) @EqualsAndHashCode.Exclude     @ToString.Exclude     private PersonEntity owner; } <\/code><\/pre>\n<p>\u0418 \u0442\u0438\u043f \u0434\u043b\u044f \u0436\u0432\u043e\u0442\u043d\u043e\u0433\u043e:<\/p>\n<pre><code class=\"java\">public enum AnimalType {     CAT,     DOG,     BIRD,     HORSE } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u044f\u043d\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>gradle build<\/code>. \u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f <em>build<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c  \u0432 \u0444\u0430\u0439\u043b\u0435 <em>build.gradle<\/em> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <a href=\"https:\/\/github.com\/liquibase\/liquibase-gradle-plugin\" rel=\"noopener noreferrer nofollow\">\u043f\u043b\u0430\u0433\u0438\u043d<\/a><\/p>\n<pre><code class=\"json\">plugins { id 'org.liquibase.gradle' version '2.0.' }<\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u044e \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043a \u0431\u0434 \u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448\u0438 entity:<\/p>\n<pre><code class=\"json\">liquibase {     activities {         main {             changeLogFile \"$buildDir\/generated-migrations.yaml\" \/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0434\u0430 \u0438 \u0441 \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b             \/\/\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0434   url \"jdbc:postgresql:\/\/localhost:5432\/testDb\"             username \"test\"             password \"test\" \/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a entity, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f hibernate(\u0434\u0438\u0430\u043b\u0435\u043a\u0442, \u0441\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f)             referenceUrl 'hibernate:spring:entity?dialect=org.hibernate.dialect.PostgreSQL10Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'   logLevel 'debug' \/\/\u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u043c \u0432\u0438\u0434\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434         }         runList = \"main\"     } } <\/code><\/pre>\n<p>\u041f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 hibernate \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/proselyte.net\/tutorials\/hibernate-tutorial\/configure\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>, \u0430 \u043f\u0440\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/351380\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u0442 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a>.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0434 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<pre><code class=\"json\"> ext {     database = new Properties().with {         load(file(\"db.properties\").newReader()) \/\/\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0431\u0434         it     } }<\/code><\/pre>\n<pre><code class=\"json\">liquibase {     activities {         main {             changeLogFile \"$buildDir\/generated-migrations.yaml\"                       \/\/\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0430 \u043d\u0435 \u0441\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f             url database.getProperty(\"dbUrl\")             username database.getProperty(\"dbUsername\")             password database.getProperty(\"dbPassword\")             referenceUrl 'hibernate:spring:entity?dialect=org.hibernate.dialect.PostgreSQL10Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'         }         runList = \"main\"     } }<\/code><\/pre>\n<p>\u0421\u0430\u043c \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 <em>db.properties<\/em><\/p>\n<pre><code class=\"json\">dbUrl=jdbc:postgresql:\/\/localhost:5432\/testDb dbUsername=test dbPassword=test <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0443 \u043d\u0443\u0436\u043d\u044b \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0431, \u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0434\u043b\u044f \u0447\u0435\u043d\u0434\u0436\u043b\u043e\u0433\u0430 \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"json\">liquibaseRuntime 'org.liquibase:liquibase-core:3.8.9' liquibaseRuntime(\"ch.qos.logback:logback-core:1.2.3\") liquibaseRuntime(\"ch.qos.logback:logback-classic:1.2.3\") \/\/\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0411\u0414 liquibaseRuntime 'org.postgresql:postgresql' \/\/hibernate &amp; spring &amp; jpa liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:3.6' liquibaseRuntime 'org.springframework.data:spring-data-jpa' liquibaseRuntime 'org.springframework.boot:spring-boot' liquibaseRuntime sourceSets.main.output \/\/\u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 yaml liquibaseRuntime 'org.yaml:snakeyaml:1.26'<\/code><\/pre>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>liquibaseRuntime sourceSets.main.output<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043b\u0430\u0433\u0438\u043d \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 entity.<\/p>\n<h2>\u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u0411\u0414<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0411\u0414. \u042f \u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u0432 \u0434\u043e\u043a\u0435\u0440\u0435, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430 \u0441\u0432\u043e\u0439 \u043f\u043a.<\/p>\n<pre><code class=\"yaml\">version: \"3.5\" services:    db:     ports:       - 5432:5432     image: postgres:12     environment:       POSTGRES_DB: testDb       POSTGRES_USER: test       POSTGRES_PASSWORD: test <\/code><\/pre>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0438\u043c changeSet&#8217;\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>diffChangeLog<\/code> <\/p>\n<p>\u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0431\u0438\u043b\u0434 \u0443 \u043d\u0430\u0441 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b <em>changelog.yaml<\/em> \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c\u0438 changeSet&#8217;\u0430\u043c\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"yaml\">databaseChangeLog:   - changeSet:       id: 1638648715035-1       author: AnnKont (generated)       changes:         - createTable:             columns:               - column:                   autoIncrement: true                   constraints:                     nullable: false                     primaryKey: true                     primaryKeyName: animalPK                   name: id                   type: BIGINT               - column:                   constraints:                     nullable: false                   name: create_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   constraints:                     nullable: false                   name: update_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   name: age                   type: BIGINT               - column:                   name: name                   type: VARCHAR(255)               - column:                   constraints:                     nullable: false                   name: type                   type: INTEGER               - column:                   name: owner_id                   type: BIGINT             tableName: animal   - changeSet:       id: 1638648715035-2       author: AnnKont (generated)       changes:         - createTable:             columns:               - column:                   autoIncrement: true                   constraints:                     nullable: false                     primaryKey: true                     primaryKeyName: personPK                   name: id                   type: BIGINT               - column:                   constraints:                     nullable: false                   name: create_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   constraints:                     nullable: false                   name: update_date                   type: TIMESTAMP WITHOUT TIME ZONE               - column:                   name: name                   type: VARCHAR(255)             tableName: person   - changeSet:       id: 1638648715035-3       author: AnnKont (generated)       changes:         - addForeignKeyConstraint:             baseColumnNames: owner_id             baseTableName: animal             constraintName: animal_person_fk01             deferrable: false             initiallyDeferred: false             referencedColumnNames: id             referencedTableName: person             validate: true<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <code>db.changelog<\/code> \u0438 \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0441\u043c\u0435\u043b\u043e \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 entity. \u0418 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u043c <code>clean<\/code> \u0438 <code>build<\/code>.<\/p>\n<pre><code class=\"java\">public class PersonEntity extends BaseEntity { \/\/\u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 name \u043d\u0430 firstName     @Column     private String firstName; \/\/\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443     @Column     private String secondName;  ... } <\/code><\/pre>\n<pre><code class=\"java\">public class AnimalEntity extends BaseEntity { \/\/\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435     @Column(nullable = false)     private String name; ... }<\/code><\/pre>\n<p>\u0421\u043d\u043e\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>diffChangeLog<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 changeSet&#8217;\u044b<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>databaseChangeLog:   - changeSet:       id: 1638650678646-1       author: AnnKont (generated)       changes:         - addNotNullConstraint:             columnDataType: varchar(255)             columnName: name             tableName: animal             validate: true   - changeSet:       id: 1638650678646-2       author: AnnKont (generated)       changes:         - addColumn:             columns:               - column:                   name: first_name                   type: varchar(255)             tableName: person   - changeSet:       id: 1638650678646-3       author: AnnKont (generated)       changes:         - addColumn:             columns:               - column:                   name:<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-403046","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/403046","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=403046"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/403046\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=403046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=403046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=403046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}