Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Re : Generate XML/ SQL output with data types of target database

$
0
0

Actually, it is necessary to manually correct the data types in the generated file. Data types are not converted automatically.

For example:

  1. ...
  2. <changeSet author="Alexey (generated)" id="1409146335011-53">
  3.    <createTable tableName="TABLE1A">
  4.       <!-- replace INT8 to NUMBER(16) for Oracle (for example) -->
  5.       <column name="total_pk" type="INT8">           
  6.          <constraints nullable="false"/>
  7.       </column>
  8.       <!-- replace INT4 to NUMBER(10) for Oracle (for example) -->
  9.       <column name="form_fk" type="INT4"> 
  10.          <constraints nullable="false"/>
  11.       </column>   
  12. ...

After that execute the command:

  1. liquibase 
  2.    --driver=oracle.jdbc.OracleDriver 
  3.    --classpath="C:\db_drivers\ojdbc14.jar" 
  4.    --changeLogFile="./postgresql_changelog.xml" 
  5.    --url="jdbc:oracle:thin:@ip_here:orabeta" 
  6.    --username=*** 
  7.    --password=***
  8.    update

The structure will be generated on the target database. Is similarly possible migrate the data (option --diffTypes = "data").

But, really, can be used "abstract" data types, as write in the documentation: Liquibase, Column tag


To help make scripts database-independent, the following “generic” data types will be converted to the correct database implementation: BOOLEAN CURRENCY UUID CLOB BLOB DATE DATETIME TIME BIGINT

Also, specifying a java.sql.Types.* type will be converted to the correct type as well. If needed, precision can be included. Here are some examples: java.sql.Types.TIMESTAMPjava.sql.Types.VARCHAR(255)


And possible to make the copy of structure without DDL (and data without DML).


Viewing all articles
Browse latest Browse all 2993

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>