liquibase.serializer.ChangeLogSerializer implementation are used by the generateChangeLog command and other functions that need to convert a DatabaseChangeLog object into a state that can be saved to disk (and re-executed at a future date).


  • A way to store a DatabaseChangeLog object into a DSL changelog format

How to Create

Create new ChangeLogSerializers by implementing the liquibase.serializer.ChangeLogSerializer interface_._  The following methods are required:

String[] getValidFileExtensions();

Used to determine which serializer to use when a particular output filename is selected.

String serialize(DatabaseChangeLog databaseChangeLog);
String serialize(ChangeSet changeSet);
String serialize(Change change);
String serialize(ColumnConfig columnConfig);

Converts the given Liquibase internal objects into a string.

Registering Custom ChangeLogSerializers

There are two ways to register a custom ChangeLogSerialzer:

  1. Create the class as a sub-package of "liquibase.serializer.ext".  Liquibase automatically registers ChangeLogSerialzer it finds in that package
  2. Call liquibase.serializer.ChangeLogSerialzerFactory.getInstance().register(serializer)

Threading/Singleton notes

ChangeLogSerialzer implementations should be created thread safe.  Once an instance of a ChangeLogSerialzer is registered, ChangeLogSerialzerFactory will continue to use the return instance.