Maven diff not working for view

Hello,

When I run mvn compile liquibase:diff, the changeSet generated contains the creation of a table instead of a view. How liquibase identifies views in java code ?

The java class:

		@Entity
		@Table(name = "CarView")
		@Immutable
		public class CarView {

			@Id
			@Column(name = "idCar", nullable = false)
			private String id;

			@Column(name = "color")
			private String color;
		}

The changeSet generated:

<changeSet author="ME" id="ID1">
    <createTable tableName="CarView">
        <column name="idCar" type="nvarchar(255)">
            <constraints nullable="false" primaryKey="true" primaryKeyName="CarViewPK"/>
        </column>
        <column name="color" type="nvarchar(255)"/>
    </createTable>
</changeSet>

And likewise, if I create view manualy, it generates:

    <changeSet author="MY" id="ID2">
        <dropView viewName="CarView"/>
    </changeSet>

Thanks for your help

Hi @NAQ_HA - Welcome to the Liquibase Community!

I have been unable to find a direct answer to your question, and I know just a little bit about Java, but I have good google search skills!

Here are some of the resources I found that may help you.

  1. Using the Liquibase Java API | Liquibase Docs
  2. Database Migrations for Java Applications | Liquibase.com

If you don’t find the information you need to figure it out, You can always post a suggestion that that functionality be investigated and added to the project at https://ideas.liquibase.com

1 Like