Skip to content
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

Oracle identity column #18

Open
luapdb opened this issue Nov 3, 2015 · 3 comments
Open

Oracle identity column #18

luapdb opened this issue Nov 3, 2015 · 3 comments

Comments

@luapdb
Copy link

luapdb commented Nov 3, 2015

I create a table with an ID column
"ADT_ID" NUMBER(19,0) GENERATED BY DEFAULT AS IDENTITY (START with 1 increment by 1),

I then run:

liquibase generateChangeLog

The Change log contains this:

      <column defaultValueComputed="&quot;LIC2_OWNER&quot;.&quot;ISEQ$$_98884&quot;.nextval" name="ADT_ID" remarks="Unique identity number of this audit trail." type="NUMBER(19, 0)">
            <constraints nullable="false"/>

Ideally we should just have metadata - stating identity column and the defaultValueComputed should not be present.

I have looked at the code which generates the SQL from the changeLog and it seems to imply that it should handle the creation of SQL based on the Identity metadata but i have not seen how it extracts this information from the database.

┆Issue is synchronized with this Jira Bug by Unito

@luapdb luapdb closed this as completed Dec 2, 2015
@luapdb luapdb reopened this Dec 2, 2015
@luapdb
Copy link
Author

luapdb commented Dec 2, 2015

I think this is a problem on the core - but cant figure out how to add this as an issue on liquibase-core

@luapdb
Copy link
Author

luapdb commented Dec 2, 2015

i looked into the code

in Columnsnapshotgenerator.java - we have this
which is returning isAutoincrement=[NO]

            if (columnMetadataResultSet.containsColumn("IS_AUTOINCREMENT")) {

                String isAutoincrement = (String) columnMetadataResultSet.get("IS_AUTOINCREMENT");
                isAutoincrement = StringUtils.trimToNull(isAutoincrement);
                //System.out.print("isAutoincrement=["+isAutoincrement+"]");

                if (isAutoincrement == null) {

@luapdb
Copy link
Author

luapdb commented Dec 3, 2015

in JdbcDatabaseSnapShot.java line 357,

we can replace
+ " C.IDENTITY_COLUMN as IS_AUTOINCREMENT, "
for

                    + " 'NO' as IS_AUTOINCREMENT, "

I have not tested but this seems to be the cause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant