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

Why DateType in SQL Server 2008 is converted as SMALLDATETIME?

$
0
0
Hello

I had an issue when generating a statement in SQL Server 2008 database with DateType class, it is generating SMALLDATETIME instead of DATETIME.

I checked the code (liquibase 3.1.1) and we have that explicity condition in liquibase.datatype.core.DateType class:

@Override
    public DatabaseDataType toDatabaseDataType(Database database) {
        if (database instanceof MSSQLDatabase) {
            try {
                if (database.getDatabaseMajorVersion() <= 9) { //2005 or earlier
                    return new DatabaseDataType("SMALLDATETIME");
                }
            } catch (DatabaseException ignore) { } //assuming it is a newer version

        }
        return new DatabaseDataType(getName());
    }

Why? 

NOTE: I already solved my issue by extending DateType class with a higher priority.

Thank you in advance!

Viewing all articles
Browse latest Browse all 2993

Trending Articles



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