-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'afterColumn' and 'position' not working in Firebird and Oracle databases #1452
Comments
@molivasdat I like to work on this issue. |
HI @chenmeister Thanks for signing up to help. I will assign this to you and look for a PR from you. |
…ebird and Oracle databases
It also does not work on Postgresql for the properties |
@theovanessen There is no way to add the properties position, afterColumn, and beforeColumn in Postgres. You can only append it at the end of the table. See link below for explanation. |
@chenmeister Thanks for the replay. I learned something again today. |
Fixes #1452: 'afterColumn' and 'position' not working in Firebird and Oracle databases
Hi @kuhjunge Can you share where you found that Oracle supports the after and before statements for column adds?
I do see the docs that Firebird does support position based alters |
Hi @kuhjunge I also tried to recreate the error you are seeing in firebird.
using isql. |
Hi @molivasdat, it seems that I confused oracle commands with MySQL commands. I cannot find anything official now either. :( I tested a firebird 2.5 database with the tool DBeaver and It should be noted in the liquibase documentation (here maybe?: https://docs.liquibase.com/concepts/advanced/column.html ) that 'position' and 'after' tag only works for certain Databases (Firebird and MySQL?) and not with for example Oracle, MS SQL and Postgresql. Otherwise I would expect, that these tags would work on every database. |
Hi @kuhjunge Thanks for doing the research. but that means is two sql statements which means 2 alter table statements are needed for the single changeset on Firebird. Where MYSQL is only one statement. |
Environment
Liquibase Version: 3.8.5 - 4.1
Liquibase Integration & Version: gradle
Liquibase Extension(s) & Version:
Database Vendor & Version: firebird 2.5, oracle
Operating System Type & Version: win 10 java 8
Description
The 'addColumn' tag supports 'afterColumn' and 'position', but these tags are ignored in the SQL generation in Firebird and Oracle ( https://docs.liquibase.com/concepts/advanced/column.html ). Therefore it is not possible to insert a column at a specific position in Firebird or after a column in Oracle.
There is also no documentation on which dbms supports 'afterColumn' or 'position'.
Steps To Reproduce
JUnit Test:
Actual Behavior
Positions and afterColumn tags are ignored.
An afterTable tag in Oracle leads to following sql:
ALTER TABLE MI6 ADD James INTEGER
A position tag in Firebird leads to following sql:
ALTER TABLE MI6 ADD James INT
Expected/Desired Behavior
<changeSet author="test" context="context" dbms="firebird" id="Test" objectQuotingStrategy="LEGACY"> <addColumn tableName="MI6"> <column name="James" position="2" type="int" valueNumeric="0"/> </addColumn> </changeSet>
should create in Firebird something like
ALTER TABLE MI6 ADD James INT POSITION 2
and
<changeSet author="test" context="context" dbms="firebird,oracle,mssql" id="Test" objectQuotingStrategy="LEGACY"> <addColumn tableName="MI6"> <column afterColumn="Bond" name="James" type="int" valueNumeric="0"/> </addColumn> </changeSet>
should create in Oracle something like
ALTER TABLE MI6 ADD James INTEGER AFTER Bond
The text was updated successfully, but these errors were encountered: