New functionalities, anyone wants?


I had to do work in liquibase code and I could not expose here because the deadline of the project was so short. (If someone interests it, I use liquibase in a Spanish research project to manage database software unit automatically).

But now I have time to expose them:

The new functionalities are:

  • Enhancement of the data types coming from Hibernate:
        -> for example: boolean, short, integer have an appriapate scale (not only number without scale)
        -> to do this, I had to change mainly three things:
            liquibase.database.Database.HibernateDatabaseSnapshot: inside method createSnapshot(…)
            liquibase.change.Change.HibernateDatabase: introducing a new attribute: HibernateGenericDialect realDialect
            liquibase.database.structure.Column: getDataTypeString(Database database) is now based in a new method -> getNumParensByDataType (Database database)

  • ModifyDataTypes changes are supported from comparation between hibernate files and database already deployed (diff-database):
        -> to do this, I had to change mainly one thing:
              liquibase.database.structure.Column: isDataTypeDifferent(Column otherColumn) is modified to isDataTypeDifferent(Column otherColumn, Database thisDatabase, Database otherDatabase) adding an important method: isHibernateTypeDifferent (Column hibernateColumn, Column databaseColumn, Database database)

  • Rollback (inverse changes) to DDL eliminatory changes is supported:
        -> createInverses(DatabaseSnapshot snapshot) in: DropAllForeignKeyConstraintsChange, DropColumnChange, DropForeignKeyConstraintChange, DropIndexChange, DropNotNullConstraintChange (already done), DropPrimaryKeyChange, DropTableChange, DropUniqueConstraintChange, DropViewChange and ModifyDataTypeChange.
        -> The best would be to add a option in every changeSet to select if this type of rollback is supported, gives a exception or is ignored (with a output trace for each impossible rollback exception).

  • Default values from column modifications are supported in diff-database:
        -> add defaultValue attribute to the classes: liquibase.change.core.ModifyDataTypeChange and liquibase.statement.SqlStatement.ModifyDataTypeStatement
        -> liquibase.sqlgenerator.SqlGenerator.ModifyDataTypeGenerator shows the sql changes from default values.
        -> The problem is that the changelog .xsd has to be changed adding the defaultValue field in the modifyColumn tag.

If anyone (Nathan?) wants to add any functionality to SVN liquibase code, I will do it. I can previously detail the code/classes-methods changes from the selected functionalities to add.

Any help you could give would be greatly appreciated, all the features you listed are needed.  The SVN repository is open for commit to anyone with a login for, and I evaluate the changes after commits.  I generally find that easier than dealing with patch files.  Since we are nearing the end of the 2.0 release and I don’t want to introduce major changes at this point, the best place to add the changes is int he “next_version” branch.

Let me know if you have any questions