<dependency>
<groupId>com.sap.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hana</artifactId>
<version>3.4.1-sap-02</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.2.3version>
</dependency>
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="liquibasePerist" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.sap.sample.model.Employee</class>
<class>com.sap.sample.model.Orders</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="javax.persistence.validation.mode" value="NONE" />
<property name="eclipselink.ddl-generation" value="none" />
<property name="eclipselink.logging.level" value="FINEST" />
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
<property name="eclipselink.jdbc.allow-native-sql-queries" value="true" />
</properties>
</persistence-unit>
</persistence>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<!-- Common definitions; e.g. field types -->
<include file="db/properties/db-changelog-properties.xml" />
<!-- REL-1.0 -->
<include file="db/changelog/changelog-V1.xml" />
</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<!-- Portable database type definitions -->
<property name="type.bigint" value="BIGINT" dbms="all,derby,hanadb" />
<property name="type.int" value="INT" dbms="all,derby,hanadb" />
<property name="type.smallint" value="SMALLINT" dbms="all,derby,hanadb"/>
<property name="type.double" value="DOUBLE" dbms="all,derby,hanadb" />
<property name="type.timestamp" value="TIMESTAMP" dbms="all,derby,hanadb" />
<property name="type.boolean" value="BOOLEAN" dbms="all,derby,hanadb" />
<property name="type.unicode120" value="NVARCHAR(120)" dbms="hanadb" />
<property name="type.unicode120" value="VARCHAR(120)" dbms="all,derby" />
<property name="type.unicode200" value="NVARCHAR(200)" dbms="hanadb" />
<property name="type.unicode200" value="VARCHAR(200)" dbms="all,derby" />
<property name="type.unicode255" value="NVARCHAR(255)" dbms="hanadb" />
<property name="type.unicode255" value="VARCHAR(255)" dbms="all,derby" />
<property name="type.unicode2k" value="NVARCHAR(2000)" dbms="hanadb" />
<property name="type.unicode2k" value="VARCHAR(2000)" dbms="all,derby" />
</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet author="I070883" id="Employee">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="EMPLOYEE" />
</not>
</preConditions>
<comment>Employee table creation (with PK)</comment>
<createTable tableName="EMPLOYEE">
<column name="EMP_ID" type="${type.unicode120}">
<constraints nullable="false" />
</column>
<column name="EMP_NAME" type="${type.unicode200}">
<constraints nullable="false" />
</column>
<column name="EMP_ADDRESS" type="${type.unicode200}">
<constraints nullable="false" />
</column>
<column name="DESCRIPTION" type="${type.unicode255}" />
<column name="PHONE" type="${type.unicode200}">
<constraints nullable="false" />
</column>
</createTable>
<addPrimaryKey columnNames=" EMP_ID " constraintName="EMPLOYEE_ID"
tableName="EMPLOYEE" />
</changeSet>
<changeSet author="I070883" id="Orders">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="ORDERS" />
</not>
</preConditions>
<comment>Orders table creation (with PK)</comment>
<createTable tableName="ORDERS">
<column name="TRANSACTION_ID" type="${type.unicode120}">
<constraints nullable="false" />
</column>
<column name="ORDER_ID" type="${type.unicode120}">
<constraints nullable="false" />
</column>
<column name="COMMENTS" type="${type.unicode200}">
<constraints nullable="false" />
</column>
</createTable>
<addPrimaryKey columnNames="TRANSACTION_ID"
constraintName="TRANSACTION_ID" tableName="ORDERS" />
</changeSet>
<!-- Add new Columns in Orders table and in precondition need to check if
column exists -->
<changeSet author="I070883" id="addNewColumnOrder">
<preConditions onFail="MARK_RAN">
<not>
<columnExists columnName="QUANTITY" tableName="ORDERS" />
</not>
</preConditions>
<comment>Orders table create new column in order table</comment>
<addColumn tableName="ORDERS">
<column name="QUANTITY" type="${type.unicode255}" />
</addColumn>
</changeSet>
<!-- Modify existing column quantity from nvarchar to bigint -->
<changeSet author="I070883" id="OrdersTableModifyColumn">
<preConditions onFail="CONTINUE">
<!-- <tableIsEmpty/>
<not>
<columnExists columnName="QUANTITY" tableName="ORDERS" />
</not> -->
</preConditions>
<modifyDataType columnName="QUANTITY" newDataType="${type.int}"
tableName="ORDERS" />
</changeSet>
</databaseChangeLog>
<context-param>
<param-name>liquibase.changelog</param-name>
<param-value>db/changelog/db-changelog.xml</param-value>
</context-param>
<context-param>
<param-name>liquibase.datasource</param-name>
<param-value>java:comp/env/jdbc/DefaultDB</param-value>
</context-param>
<listener>
<listener-class>liquibase.integration.servlet.LiquibaseServletListener</listener-class>
</listener>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 | |
10 | |
9 | |
9 | |
9 | |
6 |