Entity attribute Schema does not work for diff
See original GitHub issueFor example, i have two entities:
package ru.atc.initsqldata.entity.multischema;
import javax.persistence.*;
@Entity
@Table(schema = "schema1", name = "table1")
public class Entity1 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
}
and
package ru.atc.initsqldata.entity.multischema;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(schema = "schema2", name = "table2")
public class Entity2 {
@Id
private Long id;
private String name;
}
When i run liquibase:diff script, i have the changelog like:
databaseChangeLog:
- changeSet:
id: 1590958915435-1
author: chernikov (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
primaryKey: true
primaryKeyName: table1PK
name: id
type: BIGINT
- column:
name: name
type: VARCHAR(255)
tableName: table1
- changeSet:
id: 1590958915435-2
author: chernikov (generated)
changes:
- createTable:
columns:
- column:
constraints:
nullable: false
name: id
type: BIGINT
- column:
name: name
type: VARCHAR(255)
tableName: table2
- changeSet:
id: 1590958915435-3
author: chernikov (generated)
changes:
- addPrimaryKey:
columnNames: id
constraintName: table2PK
tableName: table2
Is it possible to get changelog like this? … tableName: table1 schemaName: schema1 … tableName: table2 schemaName: schema2
Here is my configs: pom.xml
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.5</version>
<configuration>
<propertyFile>
${project.build.outputDirectory}/properties/application-${liquibase.profile}.properties
</propertyFile>
<logging>info</logging>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.0-GA</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.12</version>
</dependency>
</dependencies>
</plugin>
and properties file:
driver=org.postgresql.Driver
url=jdbc:postgresql://localhost:5432/test_db
username=test_db
password=pas
changeLogFile=@project.basedir@/src/main/resources/liquibase/changelog-master.yaml
referenceUrl=hibernate:spring:ru.atc.initsqldata.entity.multischema?dialect=org.hibernate.dialect.PostgreSQLDialect
diffChangeLogFile=@project.basedir@/src/main/resources/liquibase/changelog-@timestamp@.yaml
ignoreClasspathPrefix=true
changelogSchemaName=liquibase
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
How can I handle different data types in an Entity-Attribute ...
using a varchar2 datatype to represent all data types in a known format. Numbers and chars are no problem, date values can be...
Read more >How can database entities and attributes be different?
Entity and Attributes are two essential terms of a database management system (DBMS). The main difference between the Entity and attribute is that...
Read more >Entity-attribute-value (EAV) design in PostgreSQL – don't do it!
This article explains what the entity-attribute-value (EAV) model is and why you shouldn't use it in a relational database.
Read more >How to model an entity type that can have different sets of ...
Not shared but, from memory, I can tell that at least three attributes are present in all Categories. 4. Is there a chance...
Read more >Exploring Performance Issues for a Clinical Database ... - NCBI
Background: The entity-attribute-value representation with classes and relationships (EAV/CR) provides a flexible and simple database schema to store ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here 2 years later.
diffChangeLog --schemas=public,other --includeSchema=true
generatesschemaName="HIBERNATE" tableName="table1"
andschemaName="HIBERNATE" tableName="table2"
for entities defined as@Table(name = "table1", schema = "public")
and@Table(name = "table2", schema = "other"
respectively.Versions:
seems like (also) unresolved #160 could be related
Same issue, its not possible to generate diff with tables in different Postgres Scheme. Liquibase is trying to generate all tables in default scheme from zero everytime.
Some quickfix? ❤️