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

How to generate rename column instead of drop column

$
0
0
Hi there,

I'm new with Liquibase. I have researched on that case but still stuck.
Environment
+ Database: PostgreSQL 9.6 on Ubuntu 
+ SOURCE
  1. table t1 ( ab int, b int) -- 0 row
  2. table t2 ( a int , b int) -- 0 row
+ TARGET
  1. table t1 (a int, b int) -- 2 row
  2. table t2 (a int, b int) -- 0 row

Then I use command below to compare source verse target
  1. ./run-liqb --driver=org.postgresql.Driver \
  2. --classpath=./lib/postgresql-42.0.0.jar \
  3. --url=jdbc:postgresql://localhost:5432/target \
  4. --username=postgres \
  5. --password=123456 \
  6. diffChangeLog \
  7. --referenceUrl=jdbc:postgresql://localhost:5432/source \
  8. --referenceUsername=postgres \
  9. --referencePassword=123456 >> dif.changelog.xml

The content of dif.changelog.xml is:
  1. <?xml version="1.1" encoding="UTF-8" standalone="no"?>
  2. <databaseChangeLog...............>
  3.     <changeSet author="sentifi (generated)" id="1490856133794-1">
  4.         <createTable tableName="t3">
  5.             <column name="a" type="INT"/>
  6.             <column name="b" type="INT"/>
  7.         </createTable>
  8.     </changeSet>
  9.     <changeSet author="sentifi (generated)" id="1490856133794-2">
  10.         <addColumn tableName="t1">
  11.             <column name="ab" type="int4"/>
  12.         </addColumn>
  13.     </changeSet>
  14.     <changeSet author="sentifi (generated)" id="1490856133794-3">
  15.         <dropColumn columnName="a" tableName="t1"/>
  16.     </changeSet>
  17. </databaseChangeLog>

Actually, I don't want to drop column t1.a on target. 
Of course, I can it manually but I hope other ways. Are there other way to work around ? 

Please ask me if you need more detailed info.

Thank you.





Viewing all articles
Browse latest Browse all 2993

Trending Articles



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