Question about addDefaultValue Change

Hi Nathan/others,

In the Change class AddDefaultValueChange the default values except Boolean are stored as String, whereas in ColumnConfig they are stored as respective types. I want to understand the rationale - why are they different? And in AddDefaultValueChange what is the serialization format the data needs to stick to? For example when I serialize a java.util.Date, does it need to be serialized as ISO date string? Any help would be appreciated.

Regards,
Shantanu

Has anybody had a chance to look at this? This is the only issue that’s causing a failing test - keeping Clj-Liquibase from a 0.1 release. Appreciate your help.


Thanks,

Shantanu

It is mainly like that to support existing changeSets.  We had to have the value types as String because people didn’t always put real values in there.  For example, for defaultValueDate they would put “NOW()”.  With 2.0, I added defaultValueComputed which should make it so that the other types could be correct object types, but since there are existing changesets I am trying not to break, I had to leave them as strings for now.  Maybe with 3.0 we can clean it up the rest of the way.  defaultValueBoolean is newer and so we could assume it is a valid Boolean value.


The format that they need to be in is assumed to be a format that the database will understand.  Each database can have classes to parse and format dates when the SQL gets generated.  From your standpoint, you just need to pass pass in a value.  ISO format would probably work best for dates.   


I would suggest with your DSL to not support strings in anythign except defaultValue and defaultValueComputed.  Have the other types be valid values.


Nathan

Thanks Nathan, that was very useful. As suggested I am making sure that the DSL accepts values of respective types only. For defaultValueComputed I am letting the user pass a DatabaseFunction instance. All unit tests are now passing for this library and I am left with documentation (the only TODO item) until a 0.1 release.


Regards,

Shantanu