Some of my databases have an auto-increment on the id column of my log
table, while others don't. As I need this auto-increment on all of my
databases, I created a changeSet like this:
However, this fails when I run it on my databases that already have this auto-increment.
I'd like something like this:
Is this possible in any way?
PS: If you're wondering why I ended up with this inconsistency on my databases, it's because MySQL deletes the auto-increment when you change a column type, while PostgreSQL doesn't.
- <changeSet id="1" author="emi">
- <addAutoIncrement columnDataType="int"
- columnName="id"
- incrementBy="1"
- startWith="1"
- tableName="log"/>
- </changeSet>
However, this fails when I run it on my databases that already have this auto-increment.
I'd like something like this:
- <changeSet id="1" author="emi">
- <preConditions>
- <not>
- <autoIncrementExists columnName="id"
- tableName="log"/>
- </not>
- </preConditions>
- <addAutoIncrement columnDataType="int"
- columnName="id"
- incrementBy="1"
- startWith="1"
- tableName="log"/>
- </changeSet>
Is this possible in any way?
PS: If you're wondering why I ended up with this inconsistency on my databases, it's because MySQL deletes the auto-increment when you change a column type, while PostgreSQL doesn't.