Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Purpose

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).

Examples

  • 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:

Code Block
String[] getValidFileExtensions();

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

Code Block
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

...

Content Moved

This content has moved to https://contribute.liquibase.com/code/api/serializer-changelogserializer/