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:
- Create the class as a sub-package of "liquibase.serializer.ext". Liquibase automatically registers ChangeLogSerialzer it finds in that package
- 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/