Support for ordering of columns in addColumn

So, I create 2 new classes that extend AddColumnChange and AddColumnGenerator
Do I need to do something with priority or does liquibase automatically pick up know to use those instead?
I was going to create AddColumnOrderedChange that extends AddColumnChange and simples add a property called afterColumn that will be a String.
Also will create a AddColumnAfterGenerator and overrride generateSql to add the “AFTER” for those databses that support it.
Both of these will need to go into a liquibase.ext package?

Also, we are using the grails-database-migration plugin which uses a groovy DSL for the changelogs.
https://github.com/grails-plugins/grails-database-migration/blob/master/src/groovy/grails/plugin/databasemigration/DslBuilder.groovy

I assume that it will just pick up the new attribute property and set them to my new AddColumnOrderedChange class?

my thought was something like

<column name=“name” type=“varchar(50)”  />


which in the builder would be
addColumn(tableName:“products”,afterColumn:"id){
   column(name:“name”, type:“varchar(50)”)
}


so it looks like I may need to do a AddColumnAfterStatement that extends AddColumnStatement too?
Am I looking at this right? then in my AddColumnAfterChange I will need to overide generateStatements so I can get the new afterColumn attribute on the AddColumnStatement and subsequesntly get it in the AddColumnAfterGenerator.generateSql? Or am I overcomplicating this?


I see there is a feature requests here http://liquibase.jira.com/browse/CORE-929
and in a prior post there was a recommendation to write an extension.

Questions for recommended starting point
1. where to start? should I look at how modifyColumn extension works and create a whole new tag?
      - in this extension on githiub I don’t see a changelog-ext.xsd.  but here it seems to be recomended http://forum.liquibase.org/topic/tutorial-write-your-own-extension

2. Should I extend the addColumn somehow?
3. can I add arbitrary attributes to the column tag? and then should I pick it up in the statement processing?


Extending AddColumnChange and AddColumnGenerator would be the easiest, because you should be able to leverage a lot of the code already in those classes.


You can add arbitrary tags, as long as they are defined in an XSD. You can use the changelog-ext.xsd which is basically an “allow anything” xsd or use your own. You don’t need to include the ext.xsd in your code, it should be found automatically by liquibase, You add the tags to your *Change class so they get saved, then process them in your *Generator class.


Nathan